summaryrefslogtreecommitdiff
path: root/chromium/v8/src/code-stub-assembler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/code-stub-assembler.cc')
-rw-r--r--chromium/v8/src/code-stub-assembler.cc71
1 files changed, 47 insertions, 24 deletions
diff --git a/chromium/v8/src/code-stub-assembler.cc b/chromium/v8/src/code-stub-assembler.cc
index 612d9b76af7..0c64d011d41 100644
--- a/chromium/v8/src/code-stub-assembler.cc
+++ b/chromium/v8/src/code-stub-assembler.cc
@@ -1253,8 +1253,8 @@ TNode<Int32T> CodeStubAssembler::LoadHashForJSObject(
{
Node* length_and_hash_int32 = LoadAndUntagToWord32ObjectField(
properties_or_hash, PropertyArray::kLengthAndHashOffset);
- var_hash.Bind(Word32And(length_and_hash_int32,
- Int32Constant(PropertyArray::kHashMask)));
+ var_hash.Bind(
+ DecodeWord32<PropertyArray::HashField>(length_and_hash_int32));
Goto(&done);
}
@@ -2322,6 +2322,7 @@ Node* CodeStubAssembler::AllocateNameDictionary(Node* at_least_space_for) {
Node* CodeStubAssembler::AllocateNameDictionaryWithCapacity(Node* capacity) {
CSA_ASSERT(this, WordIsPowerOfTwo(capacity));
+ CSA_ASSERT(this, IntPtrGreaterThan(capacity, IntPtrConstant(0)));
Node* length = EntryToIndex<NameDictionary>(capacity);
Node* store_size = IntPtrAdd(TimesPointerSize(length),
IntPtrConstant(NameDictionary::kHeaderSize));
@@ -2644,7 +2645,8 @@ void CodeStubAssembler::InitializePropertyArrayLength(Node* property_array,
CSA_ASSERT(
this,
IntPtrOrSmiLessThanOrEqual(
- length, IntPtrOrSmiConstant(PropertyArray::kMaxLength, mode), mode));
+ length, IntPtrOrSmiConstant(PropertyArray::LengthField::kMax, mode),
+ mode));
StoreObjectFieldNoWriteBarrier(
property_array, PropertyArray::kLengthAndHashOffset,
ParameterToTagged(length, mode), MachineRepresentation::kTaggedSigned);
@@ -3539,6 +3541,23 @@ Node* CodeStubAssembler::ThrowIfNotInstanceType(Node* context, Node* value,
return var_value_map.value();
}
+void CodeStubAssembler::ThrowRangeError(Node* context,
+ MessageTemplate::Template message,
+ Node* arg0, Node* arg1, Node* arg2) {
+ Node* template_index = SmiConstant(message);
+ if (arg0 == nullptr) {
+ CallRuntime(Runtime::kThrowRangeError, context, template_index);
+ } else if (arg1 == nullptr) {
+ CallRuntime(Runtime::kThrowRangeError, context, template_index, arg0);
+ } else if (arg2 == nullptr) {
+ CallRuntime(Runtime::kThrowRangeError, context, template_index, arg0, arg1);
+ } else {
+ CallRuntime(Runtime::kThrowRangeError, context, template_index, arg0, arg1,
+ arg2);
+ }
+ Unreachable();
+}
+
void CodeStubAssembler::ThrowTypeError(Node* context,
MessageTemplate::Template message,
char const* arg0, char const* arg1) {
@@ -6166,7 +6185,8 @@ void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary,
// Returns either the original value, or the result of the getter call.
Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
Node* context, Node* receiver,
- Label* if_bailout) {
+ Label* if_bailout,
+ GetOwnPropertyMode mode) {
VARIABLE(var_value, MachineRepresentation::kTagged, value);
Label done(this), if_accessor_info(this, Label::kDeferred);
@@ -6178,23 +6198,26 @@ Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
// AccessorPair case.
{
- Node* accessor_pair = value;
- Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset);
- Node* getter_map = LoadMap(getter);
- Node* instance_type = LoadMapInstanceType(getter_map);
- // FunctionTemplateInfo getters are not supported yet.
- GotoIf(
- Word32Equal(instance_type, Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)),
- if_bailout);
-
- // Return undefined if the {getter} is not callable.
- var_value.Bind(UndefinedConstant());
- GotoIfNot(IsCallableMap(getter_map), &done);
-
- // Call the accessor.
- Callable callable = CodeFactory::Call(isolate());
- Node* result = CallJS(callable, context, getter, receiver);
- var_value.Bind(result);
+ if (mode == kCallJSGetter) {
+ Node* accessor_pair = value;
+ Node* getter =
+ LoadObjectField(accessor_pair, AccessorPair::kGetterOffset);
+ Node* getter_map = LoadMap(getter);
+ Node* instance_type = LoadMapInstanceType(getter_map);
+ // FunctionTemplateInfo getters are not supported yet.
+ GotoIf(Word32Equal(instance_type,
+ Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)),
+ if_bailout);
+
+ // Return undefined if the {getter} is not callable.
+ var_value.Bind(UndefinedConstant());
+ GotoIfNot(IsCallableMap(getter_map), &done);
+
+ // Call the accessor.
+ Callable callable = CodeFactory::Call(isolate());
+ Node* result = CallJS(callable, context, getter, receiver);
+ var_value.Bind(result);
+ }
Goto(&done);
}
@@ -6264,14 +6287,14 @@ void CodeStubAssembler::TryGetOwnProperty(
Label* if_not_found, Label* if_bailout) {
TryGetOwnProperty(context, receiver, object, map, instance_type, unique_name,
if_found_value, var_value, nullptr, nullptr, if_not_found,
- if_bailout);
+ if_bailout, kCallJSGetter);
}
void CodeStubAssembler::TryGetOwnProperty(
Node* context, Node* receiver, Node* object, Node* map, Node* instance_type,
Node* unique_name, Label* if_found_value, Variable* var_value,
Variable* var_details, Variable* var_raw_value, Label* if_not_found,
- Label* if_bailout) {
+ Label* if_bailout, GetOwnPropertyMode mode) {
DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep());
Comment("TryGetOwnProperty");
@@ -6322,7 +6345,7 @@ void CodeStubAssembler::TryGetOwnProperty(
var_raw_value->Bind(var_value->value());
}
Node* value = CallGetterIfAccessor(var_value->value(), var_details->value(),
- context, receiver, if_bailout);
+ context, receiver, if_bailout, mode);
var_value->Bind(value);
Goto(if_found_value);
}