| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 FrameScope frame_scope(masm, StackFrame::MANUAL); | 414 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 415 __ push(ebp); // Caller's frame pointer. | 415 __ push(ebp); // Caller's frame pointer. |
| 416 __ mov(ebp, esp); | 416 __ mov(ebp, esp); |
| 417 __ push(esi); // Callee's context. | 417 __ push(esi); // Callee's context. |
| 418 __ push(edi); // Callee's JS function. | 418 __ push(edi); // Callee's JS function. |
| 419 __ push(edx); // Callee's new target. | 419 __ push(edx); // Callee's new target. |
| 420 | 420 |
| 421 // Get the bytecode array from the function object and load the pointer to the | 421 // Get the bytecode array from the function object and load the pointer to the |
| 422 // first entry into edi (InterpreterBytecodeRegister). | 422 // first entry into edi (InterpreterBytecodeRegister). |
| 423 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 423 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 424 |
| 425 Label load_debug_bytecode_array, bytecode_array_loaded; |
| 426 __ cmp(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset), |
| 427 Immediate(DebugInfo::uninitialized())); |
| 428 __ j(not_equal, &load_debug_bytecode_array); |
| 424 __ mov(kInterpreterBytecodeArrayRegister, | 429 __ mov(kInterpreterBytecodeArrayRegister, |
| 425 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); | 430 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); |
| 431 __ bind(&bytecode_array_loaded); |
| 426 | 432 |
| 427 if (FLAG_debug_code) { | 433 if (FLAG_debug_code) { |
| 428 // Check function data field is actually a BytecodeArray object. | 434 // Check function data field is actually a BytecodeArray object. |
| 429 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 435 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
| 430 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 436 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
| 431 eax); | 437 eax); |
| 432 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 438 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 433 } | 439 } |
| 434 | 440 |
| 435 // Push bytecode array. | 441 // Push bytecode array. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 // TODO(rmcilroy): Remove this once we move the dispatch table back into a | 503 // TODO(rmcilroy): Remove this once we move the dispatch table back into a |
| 498 // register. | 504 // register. |
| 499 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value())); | 505 __ mov(eax, Immediate(masm->isolate()->factory()->undefined_value())); |
| 500 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 506 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
| 501 // and header removal. | 507 // and header removal. |
| 502 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 508 __ add(ebx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 503 __ call(ebx); | 509 __ call(ebx); |
| 504 | 510 |
| 505 // Even though the first bytecode handler was called, we will never return. | 511 // Even though the first bytecode handler was called, we will never return. |
| 506 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 512 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
| 513 |
| 514 // Load debug copy of the bytecode array. |
| 515 __ bind(&load_debug_bytecode_array); |
| 516 Register debug_info = kInterpreterBytecodeArrayRegister; |
| 517 __ mov(debug_info, FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset)); |
| 518 __ mov(kInterpreterBytecodeArrayRegister, |
| 519 FieldOperand(debug_info, DebugInfo::kAbstractCodeIndex)); |
| 520 __ jmp(&bytecode_array_loaded); |
| 507 } | 521 } |
| 508 | 522 |
| 509 | 523 |
| 510 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 524 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
| 511 // TODO(rmcilroy): List of things not currently dealt with here but done in | 525 // TODO(rmcilroy): List of things not currently dealt with here but done in |
| 512 // fullcodegen's EmitReturnSequence. | 526 // fullcodegen's EmitReturnSequence. |
| 513 // - Supporting FLAG_trace for Runtime::TraceExit. | 527 // - Supporting FLAG_trace for Runtime::TraceExit. |
| 514 // - Support profiler (specifically decrementing profiling_counter | 528 // - Support profiler (specifically decrementing profiling_counter |
| 515 // appropriately and calling out to HandleInterrupts if necessary). | 529 // appropriately and calling out to HandleInterrupts if necessary). |
| 516 | 530 |
| (...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 | 2664 |
| 2651 __ bind(&ok); | 2665 __ bind(&ok); |
| 2652 __ ret(0); | 2666 __ ret(0); |
| 2653 } | 2667 } |
| 2654 | 2668 |
| 2655 #undef __ | 2669 #undef __ |
| 2656 } // namespace internal | 2670 } // namespace internal |
| 2657 } // namespace v8 | 2671 } // namespace v8 |
| 2658 | 2672 |
| 2659 #endif // V8_TARGET_ARCH_IA32 | 2673 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |