OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 | 8 |
9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( | 86 void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype( |
87 MacroAssembler* masm, Register receiver, Register result, Register scratch, | 87 MacroAssembler* masm, Register receiver, Register result, Register scratch, |
88 Label* miss_label) { | 88 Label* miss_label) { |
89 __ TryGetFunctionPrototype(receiver, result, miss_label); | 89 __ TryGetFunctionPrototype(receiver, result, miss_label); |
90 if (!result.is(rax)) __ movp(rax, result); | 90 if (!result.is(rax)) __ movp(rax, result); |
91 __ ret(0); | 91 __ ret(0); |
92 } | 92 } |
93 | 93 |
| 94 static void CompileCallLoadPropertyWithInterceptor( |
| 95 MacroAssembler* masm, Register receiver, Register holder, Register name, |
| 96 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
| 97 DCHECK(NamedLoadHandlerCompiler::kInterceptorArgsLength == |
| 98 Runtime::FunctionForId(id)->nargs); |
94 | 99 |
95 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | |
96 Register holder, Register name, | |
97 Handle<JSObject> holder_obj) { | |
98 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); | 100 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
99 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); | 101 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
100 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); | 102 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
101 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 103 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
102 __ Push(name); | 104 __ Push(name); |
103 __ Push(receiver); | 105 __ Push(receiver); |
104 __ Push(holder); | 106 __ Push(holder); |
105 } | |
106 | 107 |
107 | |
108 static void CompileCallLoadPropertyWithInterceptor( | |
109 MacroAssembler* masm, Register receiver, Register holder, Register name, | |
110 Handle<JSObject> holder_obj, Runtime::FunctionId id) { | |
111 DCHECK(NamedLoadHandlerCompiler::kInterceptorArgsLength == | |
112 Runtime::FunctionForId(id)->nargs); | |
113 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | |
114 __ CallRuntime(id); | 108 __ CallRuntime(id); |
115 } | 109 } |
116 | 110 |
117 | 111 |
118 // Generate call to api function. | 112 // Generate call to api function. |
119 void PropertyHandlerCompiler::GenerateApiAccessorCall( | 113 void PropertyHandlerCompiler::GenerateApiAccessorCall( |
120 MacroAssembler* masm, const CallOptimization& optimization, | 114 MacroAssembler* masm, const CallOptimization& optimization, |
121 Handle<Map> receiver_map, Register receiver, Register scratch, | 115 Handle<Map> receiver_map, Register receiver, Register scratch, |
122 bool is_store, Register store_parameter, Register accessor_holder, | 116 bool is_store, Register store_parameter, Register accessor_holder, |
123 int accessor_index) { | 117 int accessor_index) { |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 } | 511 } |
518 | 512 |
519 GenerateLoadPostInterceptor(it, holder_reg); | 513 GenerateLoadPostInterceptor(it, holder_reg); |
520 } | 514 } |
521 | 515 |
522 | 516 |
523 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 517 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
524 // Call the runtime system to load the interceptor. | 518 // Call the runtime system to load the interceptor. |
525 DCHECK(holder()->HasNamedInterceptor()); | 519 DCHECK(holder()->HasNamedInterceptor()); |
526 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 520 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
527 __ PopReturnAddressTo(scratch2()); | 521 |
528 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 522 // Stack: |
529 holder()); | 523 // return address |
530 __ PushReturnAddressFrom(scratch2()); | 524 |
| 525 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
| 526 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
| 527 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
| 528 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
| 529 __ Push(receiver()); |
| 530 __ Push(holder_reg); |
| 531 // See NamedLoadHandlerCompiler::InterceptorVectorSlotPop() for details. |
| 532 if (holder_reg.is(receiver())) { |
| 533 __ Push(slot()); |
| 534 __ Push(vector()); |
| 535 } else { |
| 536 __ Push(scratch3()); // slot |
| 537 __ Push(scratch2()); // vector |
| 538 } |
| 539 __ Push(Operand(rsp, 4 * kPointerSize)); // return address |
| 540 __ movp(Operand(rsp, 5 * kPointerSize), name()); |
531 | 541 |
532 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 542 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
533 } | 543 } |
534 | 544 |
535 void NamedStoreHandlerCompiler::ZapStackArgumentsRegisterAliases() { | 545 void NamedStoreHandlerCompiler::ZapStackArgumentsRegisterAliases() { |
536 STATIC_ASSERT(!StoreWithVectorDescriptor::kPassLastArgsOnStack); | 546 STATIC_ASSERT(!StoreWithVectorDescriptor::kPassLastArgsOnStack); |
537 } | 547 } |
538 | 548 |
539 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( | 549 Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( |
540 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, | 550 Handle<JSObject> object, Handle<Name> name, Handle<AccessorInfo> callback, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 // Return the generated code. | 615 // Return the generated code. |
606 return GetCode(kind(), name); | 616 return GetCode(kind(), name); |
607 } | 617 } |
608 | 618 |
609 | 619 |
610 #undef __ | 620 #undef __ |
611 } // namespace internal | 621 } // namespace internal |
612 } // namespace v8 | 622 } // namespace v8 |
613 | 623 |
614 #endif // V8_TARGET_ARCH_X64 | 624 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |