| Index: src/x64/code-stubs-x64.cc
|
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
|
| index 715c421c401c9a07f47ef977ebcba633ae681959..edc44fe07d6e212fe7f98d0f74e0812a9c6c0a66 100644
|
| --- a/src/x64/code-stubs-x64.cc
|
| +++ b/src/x64/code-stubs-x64.cc
|
| @@ -63,6 +63,10 @@ void TransitionElementsKindStub::InitializeInterfaceDescriptor(
|
|
|
| static void InitializeArrayConstructorDescriptor(Isolate* isolate,
|
| CodeStubInterfaceDescriptor* descriptor) {
|
| + // register state
|
| + // rdi -- constructor function
|
| + // rbx -- type info cell with elements kind
|
| + // rax -- number of arguments to the constructor function
|
| static Register registers[] = { rdi, rbx };
|
| descriptor->register_param_count_ = 2;
|
| // stack param count needs (constructor pointer, and single argument)
|
| @@ -3917,9 +3921,9 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // A monomorphic cache hit or an already megamorphic state: invoke the
|
| // function without changing the state.
|
| __ cmpq(rcx, rdi);
|
| - __ j(equal, &done, Label::kFar);
|
| + __ j(equal, &done);
|
| __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate));
|
| - __ j(equal, &done, Label::kFar);
|
| + __ j(equal, &done);
|
|
|
| // Special handling of the Array() function, which caches not only the
|
| // monomorphic Array function but the initial ElementsKind with special
|
| @@ -3927,27 +3931,19 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| Handle<Object> terminal_kind_sentinel =
|
| TypeFeedbackCells::MonomorphicArraySentinel(LAST_FAST_ELEMENTS_KIND);
|
| __ Cmp(rcx, terminal_kind_sentinel);
|
| - __ j(not_equal, &miss, Label::kFar);
|
| - // Load the global or builtins object from the current context
|
| - __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| - __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
|
| - __ movq(rcx,
|
| - Operand(rcx, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
|
| + __ j(not_equal, &miss);
|
| // Make sure the function is the Array() function
|
| + __ LoadArrayFunction(rcx);
|
| __ cmpq(rdi, rcx);
|
| - Label megamorphic_pre;
|
| - __ j(not_equal, &megamorphic_pre, Label::kFar);
|
| + __ j(not_equal, &megamorphic);
|
| __ jmp(&done);
|
|
|
| - __ bind(&megamorphic_pre);
|
| - __ jmp(&megamorphic, Label::kFar);
|
| -
|
| __ bind(&miss);
|
|
|
| // A monomorphic miss (i.e, here the cache is not uninitialized) goes
|
| // megamorphic.
|
| __ Cmp(rcx, TypeFeedbackCells::UninitializedSentinel(isolate));
|
| - __ j(equal, &initialize, Label::kFar);
|
| + __ j(equal, &initialize);
|
| // MegamorphicSentinel is an immortal immovable object (undefined) so no
|
| // write-barrier is needed.
|
| __ bind(&megamorphic);
|
| @@ -3958,11 +3954,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) {
|
| // An uninitialized cache is patched with the function or sentinel to
|
| // indicate the ElementsKind if function is the Array constructor.
|
| __ bind(&initialize);
|
| - __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
|
| - __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
|
| - __ movq(rcx,
|
| - Operand(rcx, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
|
| // Make sure the function is the Array() function
|
| + __ LoadArrayFunction(rcx);
|
| __ cmpq(rdi, rcx);
|
| __ j(not_equal, ¬_array_function);
|
|
|
|
|