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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 if (accessor_index >= 0) { | 295 if (accessor_index >= 0) { |
296 __ ret(StoreWithVectorDescriptor::kStackArgumentsCount * kPointerSize); | 296 __ ret(StoreWithVectorDescriptor::kStackArgumentsCount * kPointerSize); |
297 } else { | 297 } else { |
298 // If we generate a global code snippet for deoptimization only, don't try | 298 // If we generate a global code snippet for deoptimization only, don't try |
299 // to drop stack arguments for the StoreIC because they are not a part of | 299 // to drop stack arguments for the StoreIC because they are not a part of |
300 // expression stack and deoptimizer does not reconstruct them. | 300 // expression stack and deoptimizer does not reconstruct them. |
301 __ ret(0); | 301 __ ret(0); |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
| 305 static void CompileCallLoadPropertyWithInterceptor( |
| 306 MacroAssembler* masm, Register receiver, Register holder, Register name, |
| 307 Handle<JSObject> holder_obj, Runtime::FunctionId id) { |
| 308 DCHECK(NamedLoadHandlerCompiler::kInterceptorArgsLength == |
| 309 Runtime::FunctionForId(id)->nargs); |
305 | 310 |
306 static void PushInterceptorArguments(MacroAssembler* masm, Register receiver, | |
307 Register holder, Register name, | |
308 Handle<JSObject> holder_obj) { | |
309 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); | 311 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
310 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); | 312 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
311 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); | 313 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
312 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); | 314 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
313 __ push(name); | 315 __ push(name); |
314 __ push(receiver); | 316 __ push(receiver); |
315 __ push(holder); | 317 __ push(holder); |
316 } | |
317 | 318 |
318 | |
319 static void CompileCallLoadPropertyWithInterceptor( | |
320 MacroAssembler* masm, Register receiver, Register holder, Register name, | |
321 Handle<JSObject> holder_obj, Runtime::FunctionId id) { | |
322 DCHECK(NamedLoadHandlerCompiler::kInterceptorArgsLength == | |
323 Runtime::FunctionForId(id)->nargs); | |
324 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | |
325 __ CallRuntime(id); | 319 __ CallRuntime(id); |
326 } | 320 } |
327 | 321 |
328 #undef __ | 322 #undef __ |
329 #define __ ACCESS_MASM(masm()) | 323 #define __ ACCESS_MASM(masm()) |
330 | 324 |
331 | 325 |
332 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, | 326 void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label, |
333 Handle<Name> name) { | 327 Handle<Name> name) { |
334 if (!label->is_unused()) { | 328 if (!label->is_unused()) { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 525 } |
532 | 526 |
533 GenerateLoadPostInterceptor(it, holder_reg); | 527 GenerateLoadPostInterceptor(it, holder_reg); |
534 } | 528 } |
535 | 529 |
536 | 530 |
537 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { | 531 void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) { |
538 DCHECK(holder()->HasNamedInterceptor()); | 532 DCHECK(holder()->HasNamedInterceptor()); |
539 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); | 533 DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined(isolate())); |
540 // Call the runtime system to load the interceptor. | 534 // Call the runtime system to load the interceptor. |
541 __ pop(scratch2()); // save old return address | 535 |
542 PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), | 536 // Stack: |
543 holder()); | 537 // return address |
544 __ push(scratch2()); // restore old return address | 538 |
| 539 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsNameIndex == 0); |
| 540 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsThisIndex == 1); |
| 541 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex == 2); |
| 542 STATIC_ASSERT(NamedLoadHandlerCompiler::kInterceptorArgsLength == 3); |
| 543 __ push(receiver()); |
| 544 __ push(holder_reg); |
| 545 // See NamedLoadHandlerCompiler::InterceptorVectorSlotPop() for details. |
| 546 if (holder_reg.is(receiver())) { |
| 547 __ push(slot()); |
| 548 __ push(vector()); |
| 549 } else { |
| 550 __ push(scratch3()); // slot |
| 551 __ push(scratch2()); // vector |
| 552 } |
| 553 __ push(Operand(esp, 4 * kPointerSize)); // return address |
| 554 __ mov(Operand(esp, 5 * kPointerSize), name()); |
545 | 555 |
546 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); | 556 __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor); |
547 } | 557 } |
548 | 558 |
549 void NamedStoreHandlerCompiler::ZapStackArgumentsRegisterAliases() { | 559 void NamedStoreHandlerCompiler::ZapStackArgumentsRegisterAliases() { |
550 // Zap register aliases of the arguments passed on the stack to ensure they | 560 // Zap register aliases of the arguments passed on the stack to ensure they |
551 // are properly loaded by the handler (debug-only). | 561 // are properly loaded by the handler (debug-only). |
552 STATIC_ASSERT(Descriptor::kPassLastArgsOnStack); | 562 STATIC_ASSERT(Descriptor::kPassLastArgsOnStack); |
553 STATIC_ASSERT(Descriptor::kStackArgumentsCount == 3); | 563 STATIC_ASSERT(Descriptor::kStackArgumentsCount == 3); |
554 __ mov(Descriptor::ValueRegister(), Immediate(kDebugZapValue)); | 564 __ mov(Descriptor::ValueRegister(), Immediate(kDebugZapValue)); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 // Return the generated code. | 639 // Return the generated code. |
630 return GetCode(kind(), name); | 640 return GetCode(kind(), name); |
631 } | 641 } |
632 | 642 |
633 | 643 |
634 #undef __ | 644 #undef __ |
635 } // namespace internal | 645 } // namespace internal |
636 } // namespace v8 | 646 } // namespace v8 |
637 | 647 |
638 #endif // V8_TARGET_ARCH_IA32 | 648 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |