| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (info()->saves_caller_doubles()) { | 175 if (info()->saves_caller_doubles()) { |
| 176 SaveCallerDoubles(); | 176 SaveCallerDoubles(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Possibly allocate a local context. | 179 // Possibly allocate a local context. |
| 180 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 180 int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 181 if (heap_slots > 0) { | 181 if (heap_slots > 0) { |
| 182 Comment(";;; Allocate local context"); | 182 Comment(";;; Allocate local context"); |
| 183 bool need_write_barrier = true; | 183 bool need_write_barrier = true; |
| 184 // Argument to NewContext is the function, which is in r4. | 184 // Argument to NewContext is the function, which is in r4. |
| 185 DCHECK(!info()->scope()->is_script_scope()); |
| 185 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 186 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| 186 FastNewContextStub stub(isolate(), heap_slots); | 187 FastNewContextStub stub(isolate(), heap_slots); |
| 187 __ CallStub(&stub); | 188 __ CallStub(&stub); |
| 188 // Result of FastNewContextStub is always in new space. | 189 // Result of FastNewContextStub is always in new space. |
| 189 need_write_barrier = false; | 190 need_write_barrier = false; |
| 190 } else { | 191 } else { |
| 191 __ push(r4); | 192 __ push(r4); |
| 192 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 193 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 193 } | 194 } |
| 194 RecordSafepoint(Safepoint::kNoLazyDeopt); | 195 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| (...skipping 5998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6193 __ Push(scope_info); | 6194 __ Push(scope_info); |
| 6194 __ push(ToRegister(instr->function())); | 6195 __ push(ToRegister(instr->function())); |
| 6195 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6196 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6196 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6197 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6197 } | 6198 } |
| 6198 | 6199 |
| 6199 | 6200 |
| 6200 #undef __ | 6201 #undef __ |
| 6201 } | 6202 } |
| 6202 } // namespace v8::internal | 6203 } // namespace v8::internal |
| OLD | NEW |