aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/builtins-internal-gen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/builtins-internal-gen.cc')
-rw-r--r--deps/v8/src/builtins/builtins-internal-gen.cc117
1 files changed, 110 insertions, 7 deletions
diff --git a/deps/v8/src/builtins/builtins-internal-gen.cc b/deps/v8/src/builtins/builtins-internal-gen.cc
index baaadb722a..8d22767b58 100644
--- a/deps/v8/src/builtins/builtins-internal-gen.cc
+++ b/deps/v8/src/builtins/builtins-internal-gen.cc
@@ -614,8 +614,9 @@ class SetOrCopyDataPropertiesAssembler : public CodeStubAssembler {
Label if_done(this), if_noelements(this),
if_sourcenotjsobject(this, Label::kDeferred);
- // JSValue wrappers for numbers don't have any enumerable own properties,
- // so we can immediately skip the whole operation if {source} is a Smi.
+ // JSPrimitiveWrapper wrappers for numbers don't have any enumerable own
+ // properties, so we can immediately skip the whole operation if {source} is
+ // a Smi.
GotoIf(TaggedIsSmi(source), &if_done);
// Otherwise check if {source} is a proper JSObject, and if not, defer
@@ -809,17 +810,49 @@ TF_BUILTIN(AdaptorWithBuiltinExitFrame, CodeStubAssembler) {
TF_BUILTIN(AllocateInYoungGeneration, CodeStubAssembler) {
TNode<IntPtrT> requested_size =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kRequestedSize));
+ CSA_CHECK(this, IsValidPositiveSmi(requested_size));
+ TNode<Smi> allocation_flags =
+ SmiConstant(Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
+ AllowLargeObjectAllocationFlag::encode(true)));
TailCallRuntime(Runtime::kAllocateInYoungGeneration, NoContextConstant(),
- SmiFromIntPtr(requested_size));
+ SmiFromIntPtr(requested_size), allocation_flags);
+}
+
+TF_BUILTIN(AllocateRegularInYoungGeneration, CodeStubAssembler) {
+ TNode<IntPtrT> requested_size =
+ UncheckedCast<IntPtrT>(Parameter(Descriptor::kRequestedSize));
+ CSA_CHECK(this, IsValidPositiveSmi(requested_size));
+
+ TNode<Smi> allocation_flags =
+ SmiConstant(Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
+ AllowLargeObjectAllocationFlag::encode(false)));
+ TailCallRuntime(Runtime::kAllocateInYoungGeneration, NoContextConstant(),
+ SmiFromIntPtr(requested_size), allocation_flags);
}
TF_BUILTIN(AllocateInOldGeneration, CodeStubAssembler) {
TNode<IntPtrT> requested_size =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kRequestedSize));
+ CSA_CHECK(this, IsValidPositiveSmi(requested_size));
+
+ TNode<Smi> runtime_flags =
+ SmiConstant(Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
+ AllowLargeObjectAllocationFlag::encode(true)));
+ TailCallRuntime(Runtime::kAllocateInOldGeneration, NoContextConstant(),
+ SmiFromIntPtr(requested_size), runtime_flags);
+}
+
+TF_BUILTIN(AllocateRegularInOldGeneration, CodeStubAssembler) {
+ TNode<IntPtrT> requested_size =
+ UncheckedCast<IntPtrT>(Parameter(Descriptor::kRequestedSize));
+ CSA_CHECK(this, IsValidPositiveSmi(requested_size));
+ TNode<Smi> runtime_flags =
+ SmiConstant(Smi::FromInt(AllocateDoubleAlignFlag::encode(false) |
+ AllowLargeObjectAllocationFlag::encode(false)));
TailCallRuntime(Runtime::kAllocateInOldGeneration, NoContextConstant(),
- SmiFromIntPtr(requested_size), SmiConstant(0));
+ SmiFromIntPtr(requested_size), runtime_flags);
}
TF_BUILTIN(Abort, CodeStubAssembler) {
@@ -827,9 +860,9 @@ TF_BUILTIN(Abort, CodeStubAssembler) {
TailCallRuntime(Runtime::kAbort, NoContextConstant(), message_id);
}
-TF_BUILTIN(AbortJS, CodeStubAssembler) {
+TF_BUILTIN(AbortCSAAssert, CodeStubAssembler) {
TNode<String> message = CAST(Parameter(Descriptor::kMessageOrMessageId));
- TailCallRuntime(Runtime::kAbortJS, NoContextConstant(), message);
+ TailCallRuntime(Runtime::kAbortCSAAssert, NoContextConstant(), message);
}
void Builtins::Generate_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit(
@@ -907,6 +940,8 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext);
+ // TODO(duongn): consider tailcalling to GetPropertyWithReceiver(object,
+ // object, key, OnNonExistent::kReturnUndefined).
Label if_notfound(this), if_proxy(this, Label::kDeferred),
if_slow(this, Label::kDeferred);
@@ -932,7 +967,7 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
Goto(if_bailout);
};
- TryPrototypeChainLookup(object, key, lookup_property_in_holder,
+ TryPrototypeChainLookup(object, object, key, lookup_property_in_holder,
lookup_element_in_holder, &if_notfound, &if_slow,
&if_proxy);
@@ -955,6 +990,74 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
}
}
+// ES6 [[Get]] operation with Receiver.
+TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
+ Node* object = Parameter(Descriptor::kObject);
+ Node* key = Parameter(Descriptor::kKey);
+ Node* context = Parameter(Descriptor::kContext);
+ Node* receiver = Parameter(Descriptor::kReceiver);
+ Node* on_non_existent = Parameter(Descriptor::kOnNonExistent);
+ Label if_notfound(this), if_proxy(this, Label::kDeferred),
+ if_slow(this, Label::kDeferred);
+
+ CodeStubAssembler::LookupInHolder lookup_property_in_holder =
+ [=](Node* receiver, Node* holder, Node* holder_map,
+ Node* holder_instance_type, Node* unique_name, Label* next_holder,
+ Label* if_bailout) {
+ VARIABLE(var_value, MachineRepresentation::kTagged);
+ Label if_found(this);
+ TryGetOwnProperty(context, receiver, holder, holder_map,
+ holder_instance_type, unique_name, &if_found,
+ &var_value, next_holder, if_bailout);
+ BIND(&if_found);
+ Return(var_value.value());
+ };
+
+ CodeStubAssembler::LookupInHolder lookup_element_in_holder =
+ [=](Node* receiver, Node* holder, Node* holder_map,
+ Node* holder_instance_type, Node* index, Label* next_holder,
+ Label* if_bailout) {
+ // Not supported yet.
+ Use(next_holder);
+ Goto(if_bailout);
+ };
+
+ TryPrototypeChainLookup(receiver, object, key, lookup_property_in_holder,
+ lookup_element_in_holder, &if_notfound, &if_slow,
+ &if_proxy);
+
+ BIND(&if_notfound);
+ Label throw_reference_error(this);
+ GotoIf(WordEqual(on_non_existent,
+ SmiConstant(OnNonExistent::kThrowReferenceError)),
+ &throw_reference_error);
+ CSA_ASSERT(this, WordEqual(on_non_existent,
+ SmiConstant(OnNonExistent::kReturnUndefined)));
+ Return(UndefinedConstant());
+
+ BIND(&throw_reference_error);
+ Return(CallRuntime(Runtime::kThrowReferenceError, context, key));
+
+ BIND(&if_slow);
+ TailCallRuntime(Runtime::kGetPropertyWithReceiver, context, object, key,
+ receiver, on_non_existent);
+
+ BIND(&if_proxy);
+ {
+ // Convert the {key} to a Name first.
+ Node* name = CallBuiltin(Builtins::kToName, context, key);
+
+ // Proxy cannot handle private symbol so bailout.
+ GotoIf(IsPrivateSymbol(name), &if_slow);
+
+ // The {object} is a JSProxy instance, look up the {name} on it, passing
+ // {object} both as receiver and holder. If {name} is absent we can safely
+ // return undefined from here.
+ TailCallBuiltin(Builtins::kProxyGetProperty, context, object, name,
+ receiver, on_non_existent);
+ }
+}
+
// ES6 [[Set]] operation.
TF_BUILTIN(SetProperty, CodeStubAssembler) {
TNode<Context> context = CAST(Parameter(Descriptor::kContext));