OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 function_return_is_shadowed_ = false; | 140 function_return_is_shadowed_ = false; |
141 | 141 |
142 VirtualFrame::SpilledScope spilled_scope(this); | 142 VirtualFrame::SpilledScope spilled_scope(this); |
143 if (scope_->num_heap_slots() > 0) { | 143 if (scope_->num_heap_slots() > 0) { |
144 // Allocate local context. | 144 // Allocate local context. |
145 // Get outer context and create a new context based on it. | 145 // Get outer context and create a new context based on it. |
146 __ ldr(r0, frame_->Function()); | 146 __ ldr(r0, frame_->Function()); |
147 frame_->EmitPush(r0); | 147 frame_->EmitPush(r0); |
148 frame_->CallRuntime(Runtime::kNewContext, 1); // r0 holds the result | 148 frame_->CallRuntime(Runtime::kNewContext, 1); // r0 holds the result |
149 | 149 |
150 if (kDebug) { | 150 #ifdef DEBUG |
151 JumpTarget verified_true(this); | 151 JumpTarget verified_true(this); |
152 __ cmp(r0, Operand(cp)); | 152 __ cmp(r0, Operand(cp)); |
153 verified_true.Branch(eq); | 153 verified_true.Branch(eq); |
154 __ stop("NewContext: r0 is expected to be the same as cp"); | 154 __ stop("NewContext: r0 is expected to be the same as cp"); |
155 verified_true.Bind(); | 155 verified_true.Bind(); |
156 } | 156 #endif |
157 // Update context local. | 157 // Update context local. |
158 __ str(cp, frame_->Context()); | 158 __ str(cp, frame_->Context()); |
159 } | 159 } |
160 | 160 |
161 // TODO(1241774): Improve this code: | 161 // TODO(1241774): Improve this code: |
162 // 1) only needed if we have a context | 162 // 1) only needed if we have a context |
163 // 2) no need to recompute context ptr every single time | 163 // 2) no need to recompute context ptr every single time |
164 // 3) don't copy parameter operand code from SlotOperand! | 164 // 3) don't copy parameter operand code from SlotOperand! |
165 { | 165 { |
166 Comment cmnt2(masm_, "[ copy context parameters into .context"); | 166 Comment cmnt2(masm_, "[ copy context parameters into .context"); |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 #endif | 1416 #endif |
1417 VirtualFrame::SpilledScope spilled_scope(this); | 1417 VirtualFrame::SpilledScope spilled_scope(this); |
1418 Comment cmnt(masm_, "[ WithEnterStatement"); | 1418 Comment cmnt(masm_, "[ WithEnterStatement"); |
1419 CodeForStatementPosition(node); | 1419 CodeForStatementPosition(node); |
1420 LoadAndSpill(node->expression()); | 1420 LoadAndSpill(node->expression()); |
1421 if (node->is_catch_block()) { | 1421 if (node->is_catch_block()) { |
1422 frame_->CallRuntime(Runtime::kPushCatchContext, 1); | 1422 frame_->CallRuntime(Runtime::kPushCatchContext, 1); |
1423 } else { | 1423 } else { |
1424 frame_->CallRuntime(Runtime::kPushContext, 1); | 1424 frame_->CallRuntime(Runtime::kPushContext, 1); |
1425 } | 1425 } |
1426 if (kDebug) { | 1426 #ifdef DEBUG |
1427 JumpTarget verified_true(this); | 1427 JumpTarget verified_true(this); |
1428 __ cmp(r0, Operand(cp)); | 1428 __ cmp(r0, Operand(cp)); |
1429 verified_true.Branch(eq); | 1429 verified_true.Branch(eq); |
1430 __ stop("PushContext: r0 is expected to be the same as cp"); | 1430 __ stop("PushContext: r0 is expected to be the same as cp"); |
1431 verified_true.Bind(); | 1431 verified_true.Bind(); |
1432 } | 1432 #endif |
1433 // Update context local. | 1433 // Update context local. |
1434 __ str(cp, frame_->Context()); | 1434 __ str(cp, frame_->Context()); |
1435 ASSERT(frame_->height() == original_height); | 1435 ASSERT(frame_->height() == original_height); |
1436 } | 1436 } |
1437 | 1437 |
1438 | 1438 |
1439 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { | 1439 void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { |
1440 #ifdef DEBUG | 1440 #ifdef DEBUG |
1441 int original_height = frame_->height(); | 1441 int original_height = frame_->height(); |
1442 #endif | 1442 #endif |
(...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4649 __ str(r2, MemOperand(r3)); | 4649 __ str(r2, MemOperand(r3)); |
4650 // restore parameter- and frame-pointer and pop state. | 4650 // restore parameter- and frame-pointer and pop state. |
4651 __ ldm(ia_w, sp, r3.bit() | pp.bit() | fp.bit()); | 4651 __ ldm(ia_w, sp, r3.bit() | pp.bit() | fp.bit()); |
4652 // Before returning we restore the context from the frame pointer if not NULL. | 4652 // Before returning we restore the context from the frame pointer if not NULL. |
4653 // The frame pointer is NULL in the exception handler of a JS entry frame. | 4653 // The frame pointer is NULL in the exception handler of a JS entry frame. |
4654 __ cmp(fp, Operand(0)); | 4654 __ cmp(fp, Operand(0)); |
4655 // Set cp to NULL if fp is NULL. | 4655 // Set cp to NULL if fp is NULL. |
4656 __ mov(cp, Operand(0), LeaveCC, eq); | 4656 __ mov(cp, Operand(0), LeaveCC, eq); |
4657 // Restore cp otherwise. | 4657 // Restore cp otherwise. |
4658 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | 4658 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); |
4659 if (kDebug && FLAG_debug_code) { | 4659 #ifdef DEBUG |
| 4660 if (FLAG_debug_code) { |
4660 __ mov(lr, Operand(pc)); | 4661 __ mov(lr, Operand(pc)); |
4661 } | 4662 } |
| 4663 #endif |
4662 __ pop(pc); | 4664 __ pop(pc); |
4663 } | 4665 } |
4664 | 4666 |
4665 | 4667 |
4666 void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) { | 4668 void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) { |
4667 // Fetch top stack handler. | 4669 // Fetch top stack handler. |
4668 __ mov(r3, Operand(ExternalReference(Top::k_handler_address))); | 4670 __ mov(r3, Operand(ExternalReference(Top::k_handler_address))); |
4669 __ ldr(r3, MemOperand(r3)); | 4671 __ ldr(r3, MemOperand(r3)); |
4670 | 4672 |
4671 // Unwind the handlers until the ENTRY handler is found. | 4673 // Unwind the handlers until the ENTRY handler is found. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4714 // Discard ENTRY state (r2 is not used), and restore parameter- | 4716 // Discard ENTRY state (r2 is not used), and restore parameter- |
4715 // and frame-pointer and pop state. | 4717 // and frame-pointer and pop state. |
4716 __ ldm(ia_w, sp, r2.bit() | r3.bit() | pp.bit() | fp.bit()); | 4718 __ ldm(ia_w, sp, r2.bit() | r3.bit() | pp.bit() | fp.bit()); |
4717 // Before returning we restore the context from the frame pointer if not NULL. | 4719 // Before returning we restore the context from the frame pointer if not NULL. |
4718 // The frame pointer is NULL in the exception handler of a JS entry frame. | 4720 // The frame pointer is NULL in the exception handler of a JS entry frame. |
4719 __ cmp(fp, Operand(0)); | 4721 __ cmp(fp, Operand(0)); |
4720 // Set cp to NULL if fp is NULL. | 4722 // Set cp to NULL if fp is NULL. |
4721 __ mov(cp, Operand(0), LeaveCC, eq); | 4723 __ mov(cp, Operand(0), LeaveCC, eq); |
4722 // Restore cp otherwise. | 4724 // Restore cp otherwise. |
4723 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | 4725 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); |
4724 if (kDebug && FLAG_debug_code) { | 4726 #ifdef DEBUG |
| 4727 if (FLAG_debug_code) { |
4725 __ mov(lr, Operand(pc)); | 4728 __ mov(lr, Operand(pc)); |
4726 } | 4729 } |
| 4730 #endif |
4727 __ pop(pc); | 4731 __ pop(pc); |
4728 } | 4732 } |
4729 | 4733 |
4730 | 4734 |
4731 void CEntryStub::GenerateCore(MacroAssembler* masm, | 4735 void CEntryStub::GenerateCore(MacroAssembler* masm, |
4732 Label* throw_normal_exception, | 4736 Label* throw_normal_exception, |
4733 Label* throw_out_of_memory_exception, | 4737 Label* throw_out_of_memory_exception, |
4734 StackFrame::Type frame_type, | 4738 StackFrame::Type frame_type, |
4735 bool do_gc, | 4739 bool do_gc, |
4736 bool always_allocate) { | 4740 bool always_allocate) { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5138 __ mov(r2, Operand(0)); | 5142 __ mov(r2, Operand(0)); |
5139 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 5143 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
5140 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 5144 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
5141 RelocInfo::CODE_TARGET); | 5145 RelocInfo::CODE_TARGET); |
5142 } | 5146 } |
5143 | 5147 |
5144 | 5148 |
5145 #undef __ | 5149 #undef __ |
5146 | 5150 |
5147 } } // namespace v8::internal | 5151 } } // namespace v8::internal |
OLD | NEW |