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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.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/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 SetVar(arguments, rax, rbx, rdx); | 280 SetVar(arguments, rax, rbx, rdx); |
281 } | 281 } |
282 | 282 |
283 if (FLAG_trace) { | 283 if (FLAG_trace) { |
284 __ CallRuntime(Runtime::kTraceEnter); | 284 __ CallRuntime(Runtime::kTraceEnter); |
285 } | 285 } |
286 | 286 |
287 // Visit the declarations and body unless there is an illegal | 287 // Visit the declarations and body unless there is an illegal |
288 // redeclaration. | 288 // redeclaration. |
289 if (scope()->HasIllegalRedeclaration()) { | 289 PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS); |
290 EmitIllegalRedeclaration(); | 290 { |
291 } else { | 291 Comment cmnt(masm_, "[ Declarations"); |
292 PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS); | 292 VisitDeclarations(scope()->declarations()); |
293 { Comment cmnt(masm_, "[ Declarations"); | 293 } |
294 VisitDeclarations(scope()->declarations()); | |
295 } | |
296 | 294 |
297 // Assert that the declarations do not use ICs. Otherwise the debugger | 295 // Assert that the declarations do not use ICs. Otherwise the debugger |
298 // won't be able to redirect a PC at an IC to the correct IC in newly | 296 // won't be able to redirect a PC at an IC to the correct IC in newly |
299 // recompiled code. | 297 // recompiled code. |
300 DCHECK_EQ(0, ic_total_count_); | 298 DCHECK_EQ(0, ic_total_count_); |
301 | 299 |
302 { Comment cmnt(masm_, "[ Stack check"); | 300 { |
303 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); | 301 Comment cmnt(masm_, "[ Stack check"); |
304 Label ok; | 302 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); |
305 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 303 Label ok; |
306 __ j(above_equal, &ok, Label::kNear); | 304 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
307 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); | 305 __ j(above_equal, &ok, Label::kNear); |
308 __ bind(&ok); | 306 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
309 } | 307 __ bind(&ok); |
| 308 } |
310 | 309 |
311 { Comment cmnt(masm_, "[ Body"); | 310 { |
312 DCHECK(loop_depth() == 0); | 311 Comment cmnt(masm_, "[ Body"); |
313 VisitStatements(literal()->body()); | 312 DCHECK(loop_depth() == 0); |
314 DCHECK(loop_depth() == 0); | 313 VisitStatements(literal()->body()); |
315 } | 314 DCHECK(loop_depth() == 0); |
316 } | 315 } |
317 | 316 |
318 // Always emit a 'return undefined' in case control fell off the end of | 317 // Always emit a 'return undefined' in case control fell off the end of |
319 // the body. | 318 // the body. |
320 { Comment cmnt(masm_, "[ return <undefined>;"); | 319 { Comment cmnt(masm_, "[ return <undefined>;"); |
321 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 320 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
322 EmitReturnSequence(); | 321 EmitReturnSequence(); |
323 } | 322 } |
324 } | 323 } |
325 | 324 |
(...skipping 3664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3990 DCHECK_EQ( | 3989 DCHECK_EQ( |
3991 isolate->builtins()->OnStackReplacement()->entry(), | 3990 isolate->builtins()->OnStackReplacement()->entry(), |
3992 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3991 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3993 return ON_STACK_REPLACEMENT; | 3992 return ON_STACK_REPLACEMENT; |
3994 } | 3993 } |
3995 | 3994 |
3996 } // namespace internal | 3995 } // namespace internal |
3997 } // namespace v8 | 3996 } // namespace v8 |
3998 | 3997 |
3999 #endif // V8_TARGET_ARCH_X64 | 3998 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |