summaryrefslogtreecommitdiff
path: root/chromium/v8/src/builtins/object-fromentries.tq
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-06 12:48:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:33:43 +0000
commit7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (patch)
treefa14ba0ca8d2683ba2efdabd246dc9b18a1229c6 /chromium/v8/src/builtins/object-fromentries.tq
parent79b4f909db1049fca459c07cca55af56a9b54fe3 (diff)
downloadqtwebengine-chromium-7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3.tar.gz
BASELINE: Update Chromium to 84.0.4147.141
Change-Id: Ib85eb4cfa1cbe2b2b81e5022c8cad5c493969535 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/builtins/object-fromentries.tq')
-rw-r--r--chromium/v8/src/builtins/object-fromentries.tq102
1 files changed, 50 insertions, 52 deletions
diff --git a/chromium/v8/src/builtins/object-fromentries.tq b/chromium/v8/src/builtins/object-fromentries.tq
index 2dbe9beacf1..32d4dea1574 100644
--- a/chromium/v8/src/builtins/object-fromentries.tq
+++ b/chromium/v8/src/builtins/object-fromentries.tq
@@ -4,65 +4,63 @@
namespace object {
- transitioning macro ObjectFromEntriesFastCase(implicit context: Context)(
- iterable: JSAny): JSObject labels IfSlow {
- typeswitch (iterable) {
- case (array: FastJSArrayWithNoCustomIteration): {
- const elements: FixedArray =
- Cast<FixedArray>(array.elements) otherwise IfSlow;
- const length: Smi = array.length;
- const result: JSObject = NewJSObject();
+transitioning macro ObjectFromEntriesFastCase(implicit context: Context)(
+ iterable: JSAny): JSObject labels IfSlow {
+ typeswitch (iterable) {
+ case (array: FastJSArrayWithNoCustomIteration): {
+ const elements: FixedArray =
+ Cast<FixedArray>(array.elements) otherwise IfSlow;
+ const length: Smi = array.length;
+ const result: JSObject = NewJSObject();
- for (let k: Smi = 0; k < length; ++k) {
- const value: JSAny = array::LoadElementOrUndefined(elements, k);
- const pair: KeyValuePair =
- collections::LoadKeyValuePairNoSideEffects(value)
- otherwise IfSlow;
- // Bail out if ToPropertyKey will attempt to load and call
- // Symbol.toPrimitive, toString, and valueOf, which could
- // invalidate assumptions about the iterable.
- if (Is<JSReceiver>(pair.key)) goto IfSlow;
- FastCreateDataProperty(result, pair.key, pair.value);
- }
- return result;
- }
- case (JSAny): {
- goto IfSlow;
+ for (let k: Smi = 0; k < length; ++k) {
+ const value: JSAny = array::LoadElementOrUndefined(elements, k);
+ const pair: KeyValuePair =
+ collections::LoadKeyValuePairNoSideEffects(value)
+ otherwise IfSlow;
+ // Bail out if ToPropertyKey will attempt to load and call
+ // Symbol.toPrimitive, toString, and valueOf, which could
+ // invalidate assumptions about the iterable.
+ if (Is<JSReceiver>(pair.key)) goto IfSlow;
+ FastCreateDataProperty(result, pair.key, pair.value);
}
+ return result;
+ }
+ case (JSAny): {
+ goto IfSlow;
}
}
+}
- transitioning javascript builtin
- ObjectFromEntries(js-implicit context: NativeContext, receiver: JSAny)(
- ...arguments): JSAny {
- const iterable: JSAny = arguments[0];
+transitioning javascript builtin
+ObjectFromEntries(
+ js-implicit context: NativeContext, receiver: JSAny)(...arguments): JSAny {
+ const iterable: JSAny = arguments[0];
+ try {
+ if (IsNullOrUndefined(iterable)) goto Throw;
+ return ObjectFromEntriesFastCase(iterable) otherwise IfSlow;
+ } label IfSlow {
+ const result: JSObject = NewJSObject();
+ const fastIteratorResultMap: Map = GetIteratorResultMap();
+ let i: iterator::IteratorRecord = iterator::GetIterator(iterable);
try {
- if (IsNullOrUndefined(iterable)) goto Throw;
- return ObjectFromEntriesFastCase(iterable) otherwise IfSlow;
- }
- label IfSlow {
- const result: JSObject = NewJSObject();
- const fastIteratorResultMap: Map = GetIteratorResultMap();
- let i: iterator::IteratorRecord = iterator::GetIterator(iterable);
- try {
- assert(!IsNullOrUndefined(i.object));
- while (true) {
- const step: JSReceiver =
- iterator::IteratorStep(i, fastIteratorResultMap)
- otherwise return result;
- const iteratorValue: JSAny =
- iterator::IteratorValue(step, fastIteratorResultMap);
- const pair: KeyValuePair =
- collections::LoadKeyValuePair(iteratorValue);
- FastCreateDataProperty(result, pair.key, pair.value);
- }
- return result;
- } catch (e) deferred {
- iterator::IteratorCloseOnException(i, e);
+ assert(!IsNullOrUndefined(i.object));
+ while (true) {
+ const step: JSReceiver =
+ iterator::IteratorStep(i, fastIteratorResultMap)
+ otherwise return result;
+ const iteratorValue: JSAny =
+ iterator::IteratorValue(step, fastIteratorResultMap);
+ const pair: KeyValuePair = collections::LoadKeyValuePair(iteratorValue);
+ FastCreateDataProperty(result, pair.key, pair.value);
}
+ return result;
+ } catch (e) deferred {
+ iterator::IteratorCloseOnException(i);
+ ReThrow(context, e);
}
- label Throw deferred {
- ThrowTypeError(MessageTemplate::kNotIterable);
- }
+ } label Throw deferred {
+ ThrowTypeError(MessageTemplate::kNotIterable);
}
+}
} // namespace object