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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 FrameScope frame_scope(masm, StackFrame::MANUAL); | 415 FrameScope frame_scope(masm, StackFrame::MANUAL); |
416 __ push(ebp); // Caller's frame pointer. | 416 __ push(ebp); // Caller's frame pointer. |
417 __ mov(ebp, esp); | 417 __ mov(ebp, esp); |
418 __ push(esi); // Callee's context. | 418 __ push(esi); // Callee's context. |
419 __ push(edi); // Callee's JS function. | 419 __ push(edi); // Callee's JS function. |
420 __ push(edx); // Callee's new target. | 420 __ push(edx); // Callee's new target. |
421 | 421 |
422 // Get the bytecode array from the function object and load the pointer to the | 422 // Get the bytecode array from the function object and load the pointer to the |
423 // first entry into edi (InterpreterBytecodeRegister). | 423 // first entry into edi (InterpreterBytecodeRegister). |
424 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 424 __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 425 |
| 426 Label load_debug_bytecode_array, bytecode_array_loaded; |
| 427 __ cmp(FieldOperand(eax, SharedFunctionInfo::kDebugInfoOffset), |
| 428 Immediate(DebugInfo::uninitialized())); |
| 429 __ j(not_equal, &load_debug_bytecode_array); |
425 __ mov(kInterpreterBytecodeArrayRegister, | 430 __ mov(kInterpreterBytecodeArrayRegister, |
426 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); | 431 FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset)); |
| 432 __ bind(&bytecode_array_loaded); |
427 | 433 |
428 if (FLAG_debug_code) { | 434 if (FLAG_debug_code) { |
429 // Check function data field is actually a BytecodeArray object. | 435 // Check function data field is actually a BytecodeArray object. |
430 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); | 436 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); |
431 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, | 437 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, |
432 eax); | 438 eax); |
433 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 439 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
434 } | 440 } |
435 | 441 |
436 // Push bytecode array. | 442 // Push bytecode array. |
(...skipping 60 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 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 | 2689 |
2676 __ bind(&ok); | 2690 __ bind(&ok); |
2677 __ ret(0); | 2691 __ ret(0); |
2678 } | 2692 } |
2679 | 2693 |
2680 #undef __ | 2694 #undef __ |
2681 } // namespace internal | 2695 } // namespace internal |
2682 } // namespace v8 | 2696 } // namespace v8 |
2683 | 2697 |
2684 #endif // V8_TARGET_ARCH_X87 | 2698 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |