diff options
Diffstat (limited to 'deps/v8/src/builtins/builtins-object.cc')
-rw-r--r-- | deps/v8/src/builtins/builtins-object.cc | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/deps/v8/src/builtins/builtins-object.cc b/deps/v8/src/builtins/builtins-object.cc index c422145a51..671397d9ea 100644 --- a/deps/v8/src/builtins/builtins-object.cc +++ b/deps/v8/src/builtins/builtins-object.cc @@ -35,7 +35,7 @@ void Builtins::Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler) { Node* map = assembler->LoadMap(object); Node* instance_type = assembler->LoadMapInstanceType(map); - Variable var_index(assembler, MachineRepresentation::kWord32); + Variable var_index(assembler, MachineType::PointerRepresentation()); Label keyisindex(assembler), if_iskeyunique(assembler); assembler->TryToName(key, &keyisindex, &var_index, &if_iskeyunique, @@ -46,6 +46,10 @@ void Builtins::Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler) { &return_false, &call_runtime); assembler->Bind(&keyisindex); + // Handle negative keys in the runtime. + assembler->GotoIf(assembler->IntPtrLessThan(var_index.value(), + assembler->IntPtrConstant(0)), + &call_runtime); assembler->TryLookupElement(object, map, instance_type, var_index.value(), &return_true, &return_false, &call_runtime); @@ -230,10 +234,8 @@ void IsString(CodeStubAssembler* assembler, compiler::Node* object, { Node* instance_type = assembler->LoadInstanceType(object); - assembler->Branch( - assembler->Int32LessThan( - instance_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)), - if_string, if_notstring); + assembler->Branch(assembler->IsStringInstanceType(instance_type), if_string, + if_notstring); } } @@ -259,10 +261,8 @@ void ReturnIfPrimitive(CodeStubAssembler* assembler, CodeStubAssembler::Label* return_string, CodeStubAssembler::Label* return_boolean, CodeStubAssembler::Label* return_number) { - assembler->GotoIf( - assembler->Int32LessThan(instance_type, - assembler->Int32Constant(FIRST_NONSTRING_TYPE)), - return_string); + assembler->GotoIf(assembler->IsStringInstanceType(instance_type), + return_string); assembler->GotoIf(assembler->Word32Equal( instance_type, assembler->Int32Constant(ODDBALL_TYPE)), @@ -910,5 +910,18 @@ BUILTIN(ObjectSeal) { return *object; } +// ES6 section 7.3.19 OrdinaryHasInstance ( C, O ) +void Builtins::Generate_OrdinaryHasInstance(CodeStubAssembler* assembler) { + typedef compiler::Node Node; + typedef CompareDescriptor Descriptor; + + Node* constructor = assembler->Parameter(Descriptor::kLeft); + Node* object = assembler->Parameter(Descriptor::kRight); + Node* context = assembler->Parameter(Descriptor::kContext); + + assembler->Return( + assembler->OrdinaryHasInstance(context, constructor, object)); +} + } // namespace internal } // namespace v8 |