OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4330 __ cmp(scratch, kSymbolTag | kStringTag); | 4330 __ cmp(scratch, kSymbolTag | kStringTag); |
4331 __ j(not_equal, label); | 4331 __ j(not_equal, label); |
4332 } | 4332 } |
4333 | 4333 |
4334 | 4334 |
4335 void StackCheckStub::Generate(MacroAssembler* masm) { | 4335 void StackCheckStub::Generate(MacroAssembler* masm) { |
4336 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); | 4336 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); |
4337 } | 4337 } |
4338 | 4338 |
4339 | 4339 |
4340 void CallFunctionStub::FinishCode(Code* code) { | 4340 void CallFunctionStub::FinishCode(Handle<Code> code) { |
4341 code->set_has_function_cache(RecordCallTarget()); | 4341 code->set_has_function_cache(RecordCallTarget()); |
4342 } | 4342 } |
4343 | 4343 |
4344 | 4344 |
4345 void CallFunctionStub::Clear(Heap* heap, Address address) { | 4345 void CallFunctionStub::Clear(Heap* heap, Address address) { |
4346 ASSERT(Memory::uint8_at(address + kPointerSize) == Assembler::kTestEaxByte); | 4346 ASSERT(Memory::uint8_at(address + kPointerSize) == Assembler::kTestEaxByte); |
4347 // 1 ~ size of the test eax opcode. | 4347 // 1 ~ size of the test eax opcode. |
4348 Object* cell = Memory::Object_at(address + kPointerSize + 1); | 4348 Object* cell = Memory::Object_at(address + kPointerSize + 1); |
4349 // Low-level because clearing happens during GC. | 4349 // Low-level because clearing happens during GC. |
4350 reinterpret_cast<JSGlobalPropertyCell*>(cell)->set_value( | 4350 reinterpret_cast<JSGlobalPropertyCell*>(cell)->set_value( |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4708 | 4708 |
4709 __ bind(&throw_termination_exception); | 4709 __ bind(&throw_termination_exception); |
4710 GenerateThrowUncatchable(masm, TERMINATION); | 4710 GenerateThrowUncatchable(masm, TERMINATION); |
4711 | 4711 |
4712 __ bind(&throw_normal_exception); | 4712 __ bind(&throw_normal_exception); |
4713 GenerateThrowTOS(masm); | 4713 GenerateThrowTOS(masm); |
4714 } | 4714 } |
4715 | 4715 |
4716 | 4716 |
4717 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 4717 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
4718 Label invoke, exit; | 4718 Label invoke, handler_entry, exit; |
4719 Label not_outermost_js, not_outermost_js_2; | 4719 Label not_outermost_js, not_outermost_js_2; |
4720 | 4720 |
4721 // Setup frame. | 4721 // Setup frame. |
4722 __ push(ebp); | 4722 __ push(ebp); |
4723 __ mov(ebp, esp); | 4723 __ mov(ebp, esp); |
4724 | 4724 |
4725 // Push marker in two places. | 4725 // Push marker in two places. |
4726 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; | 4726 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; |
4727 __ push(Immediate(Smi::FromInt(marker))); // context slot | 4727 __ push(Immediate(Smi::FromInt(marker))); // context slot |
4728 __ push(Immediate(Smi::FromInt(marker))); // function slot | 4728 __ push(Immediate(Smi::FromInt(marker))); // function slot |
(...skipping 12 matching lines...) Expand all Loading... |
4741 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); | 4741 __ cmp(Operand::StaticVariable(js_entry_sp), Immediate(0)); |
4742 __ j(not_equal, ¬_outermost_js, Label::kNear); | 4742 __ j(not_equal, ¬_outermost_js, Label::kNear); |
4743 __ mov(Operand::StaticVariable(js_entry_sp), ebp); | 4743 __ mov(Operand::StaticVariable(js_entry_sp), ebp); |
4744 __ push(Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); | 4744 __ push(Immediate(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME))); |
4745 Label cont; | 4745 Label cont; |
4746 __ jmp(&cont, Label::kNear); | 4746 __ jmp(&cont, Label::kNear); |
4747 __ bind(¬_outermost_js); | 4747 __ bind(¬_outermost_js); |
4748 __ push(Immediate(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); | 4748 __ push(Immediate(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME))); |
4749 __ bind(&cont); | 4749 __ bind(&cont); |
4750 | 4750 |
4751 // Call a faked try-block that does the invoke. | 4751 // Jump to a faked try block that does the invoke, with a faked catch |
4752 __ call(&invoke); | 4752 // block that sets the pending exception. |
4753 | 4753 __ jmp(&invoke); |
4754 // Caught exception: Store result (exception) in the pending | 4754 __ bind(&handler_entry); |
4755 // exception field in the JSEnv and return a failure sentinel. | 4755 handler_offset_ = handler_entry.pos(); |
| 4756 // Caught exception: Store result (exception) in the pending exception |
| 4757 // field in the JSEnv and return a failure sentinel. |
4756 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, | 4758 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, |
4757 masm->isolate()); | 4759 masm->isolate()); |
4758 __ mov(Operand::StaticVariable(pending_exception), eax); | 4760 __ mov(Operand::StaticVariable(pending_exception), eax); |
4759 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); | 4761 __ mov(eax, reinterpret_cast<int32_t>(Failure::Exception())); |
4760 __ jmp(&exit); | 4762 __ jmp(&exit); |
4761 | 4763 |
4762 // Invoke: Link this frame into the handler chain. | 4764 // Invoke: Link this frame into the handler chain. There's only one |
| 4765 // handler block in this code object, so its index is 0. |
4763 __ bind(&invoke); | 4766 __ bind(&invoke); |
4764 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); | 4767 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER, 0); |
4765 | 4768 |
4766 // Clear any pending exceptions. | 4769 // Clear any pending exceptions. |
4767 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); | 4770 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); |
4768 __ mov(Operand::StaticVariable(pending_exception), edx); | 4771 __ mov(Operand::StaticVariable(pending_exception), edx); |
4769 | 4772 |
4770 // Fake a receiver (NULL). | 4773 // Fake a receiver (NULL). |
4771 __ push(Immediate(0)); // receiver | 4774 __ push(Immediate(0)); // receiver |
4772 | 4775 |
4773 // Invoke the function by calling through JS entry trampoline | 4776 // Invoke the function by calling through JS entry trampoline builtin and |
4774 // builtin and pop the faked function when we return. Notice that we | 4777 // pop the faked function when we return. Notice that we cannot store a |
4775 // cannot store a reference to the trampoline code directly in this | 4778 // reference to the trampoline code directly in this stub, because the |
4776 // stub, because the builtin stubs may not have been generated yet. | 4779 // builtin stubs may not have been generated yet. |
4777 if (is_construct) { | 4780 if (is_construct) { |
4778 ExternalReference construct_entry( | 4781 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, |
4779 Builtins::kJSConstructEntryTrampoline, | 4782 masm->isolate()); |
4780 masm->isolate()); | |
4781 __ mov(edx, Immediate(construct_entry)); | 4783 __ mov(edx, Immediate(construct_entry)); |
4782 } else { | 4784 } else { |
4783 ExternalReference entry(Builtins::kJSEntryTrampoline, | 4785 ExternalReference entry(Builtins::kJSEntryTrampoline, |
4784 masm->isolate()); | 4786 masm->isolate()); |
4785 __ mov(edx, Immediate(entry)); | 4787 __ mov(edx, Immediate(entry)); |
4786 } | 4788 } |
4787 __ mov(edx, Operand(edx, 0)); // deref address | 4789 __ mov(edx, Operand(edx, 0)); // deref address |
4788 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); | 4790 __ lea(edx, FieldOperand(edx, Code::kHeaderSize)); |
4789 __ call(edx); | 4791 __ call(edx); |
4790 | 4792 |
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7111 __ bind(&element_done); | 7113 __ bind(&element_done); |
7112 __ ret(0); | 7114 __ ret(0); |
7113 } | 7115 } |
7114 } | 7116 } |
7115 | 7117 |
7116 #undef __ | 7118 #undef __ |
7117 | 7119 |
7118 } } // namespace v8::internal | 7120 } } // namespace v8::internal |
7119 | 7121 |
7120 #endif // V8_TARGET_ARCH_IA32 | 7122 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |