OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 int locals_count = fun->scope()->num_stack_slots(); | 64 int locals_count = fun->scope()->num_stack_slots(); |
65 if (locals_count > 0) { | 65 if (locals_count > 0) { |
66 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 66 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
67 } | 67 } |
68 __ LoadRoot(r2, Heap::kStackLimitRootIndex); | 68 __ LoadRoot(r2, Heap::kStackLimitRootIndex); |
69 for (int i = 0; i < locals_count; i++) { | 69 for (int i = 0; i < locals_count; i++) { |
70 __ push(ip); | 70 __ push(ip); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
| 74 // Possibly allocate a local context. |
| 75 if (fun->scope()->num_heap_slots() > 0) { |
| 76 Comment cmnt(masm_, "[ Allocate local context"); |
| 77 // Argument to NewContext is the function, still in r1. |
| 78 __ push(r1); |
| 79 __ CallRuntime(Runtime::kNewContext, 1); |
| 80 // Context is returned in both r0 and cp. It replaces the context |
| 81 // passed to us. It's saved in the stack and kept live in cp. |
| 82 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 83 #ifdef DEBUG |
| 84 // Assert we do not have to copy any parameters into the context. |
| 85 for (int i = 0, len = fun->scope()->num_parameters(); i < len; i++) { |
| 86 Slot* slot = fun->scope()->parameter(i)->slot(); |
| 87 ASSERT(slot != NULL && slot->type() != Slot::CONTEXT); |
| 88 } |
| 89 #endif |
| 90 } |
| 91 |
74 // Check the stack for overflow or break request. | 92 // Check the stack for overflow or break request. |
75 // Put the lr setup instruction in the delay slot. The kInstrSize is | 93 // Put the lr setup instruction in the delay slot. The kInstrSize is |
76 // added to the implicit 8 byte offset that always applies to operations | 94 // added to the implicit 8 byte offset that always applies to operations |
77 // with pc and gives a return address 12 bytes down. | 95 // with pc and gives a return address 12 bytes down. |
78 Comment cmnt(masm_, "[ Stack check"); | 96 Comment cmnt(masm_, "[ Stack check"); |
79 __ add(lr, pc, Operand(Assembler::kInstrSize)); | 97 __ add(lr, pc, Operand(Assembler::kInstrSize)); |
80 __ cmp(sp, Operand(r2)); | 98 __ cmp(sp, Operand(r2)); |
81 StackCheckStub stub; | 99 StackCheckStub stub; |
82 __ mov(pc, | 100 __ mov(pc, |
83 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), | 101 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 true_label_ = saved_true; | 1311 true_label_ = saved_true; |
1294 false_label_ = saved_false; | 1312 false_label_ = saved_false; |
1295 // Convert current context to test context: End post-test code. | 1313 // Convert current context to test context: End post-test code. |
1296 } | 1314 } |
1297 | 1315 |
1298 | 1316 |
1299 #undef __ | 1317 #undef __ |
1300 | 1318 |
1301 | 1319 |
1302 } } // namespace v8::internal | 1320 } } // namespace v8::internal |
OLD | NEW |