| 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/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // o rsi: our context | 86 // o rsi: our context |
| 87 // o rbp: our caller's frame pointer | 87 // o rbp: our caller's frame pointer |
| 88 // o rsp: stack pointer (pointing to return address) | 88 // o rsp: stack pointer (pointing to return address) |
| 89 // | 89 // |
| 90 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 90 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 91 // frames-x64.h for its layout. | 91 // frames-x64.h for its layout. |
| 92 void FullCodeGenerator::Generate() { | 92 void FullCodeGenerator::Generate() { |
| 93 CompilationInfo* info = info_; | 93 CompilationInfo* info = info_; |
| 94 profiling_counter_ = isolate()->factory()->NewCell( | 94 profiling_counter_ = isolate()->factory()->NewCell( |
| 95 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 95 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
| 96 SetFunctionPosition(function()); | 96 SetFunctionPosition(literal()); |
| 97 Comment cmnt(masm_, "[ function compiled by full code generator"); | 97 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 98 | 98 |
| 99 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 99 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 100 | 100 |
| 101 #ifdef DEBUG | 101 #ifdef DEBUG |
| 102 if (strlen(FLAG_stop_at) > 0 && | 102 if (strlen(FLAG_stop_at) > 0 && |
| 103 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 103 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 104 __ int3(); | 104 __ int3(); |
| 105 } | 105 } |
| 106 #endif | 106 #endif |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 __ Push(rdx); | 312 __ Push(rdx); |
| 313 __ Push(Smi::FromInt(num_parameters)); | 313 __ Push(Smi::FromInt(num_parameters)); |
| 314 // Arguments to ArgumentsAccessStub: | 314 // Arguments to ArgumentsAccessStub: |
| 315 // function, receiver address, parameter count. | 315 // function, receiver address, parameter count. |
| 316 // The stub will rewrite receiver and parameter count if the previous | 316 // The stub will rewrite receiver and parameter count if the previous |
| 317 // stack frame was an arguments adapter frame. | 317 // stack frame was an arguments adapter frame. |
| 318 | 318 |
| 319 ArgumentsAccessStub::Type type; | 319 ArgumentsAccessStub::Type type; |
| 320 if (is_strict(language_mode()) || !has_simple_parameters()) { | 320 if (is_strict(language_mode()) || !has_simple_parameters()) { |
| 321 type = ArgumentsAccessStub::NEW_STRICT; | 321 type = ArgumentsAccessStub::NEW_STRICT; |
| 322 } else if (function()->has_duplicate_parameters()) { | 322 } else if (literal()->has_duplicate_parameters()) { |
| 323 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 323 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
| 324 } else { | 324 } else { |
| 325 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 325 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
| 326 } | 326 } |
| 327 ArgumentsAccessStub stub(isolate(), type); | 327 ArgumentsAccessStub stub(isolate(), type); |
| 328 __ CallStub(&stub); | 328 __ CallStub(&stub); |
| 329 | 329 |
| 330 SetVar(arguments, rax, rbx, rdx); | 330 SetVar(arguments, rax, rbx, rdx); |
| 331 } | 331 } |
| 332 | 332 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 355 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); | 355 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); |
| 356 Label ok; | 356 Label ok; |
| 357 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 357 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
| 358 __ j(above_equal, &ok, Label::kNear); | 358 __ j(above_equal, &ok, Label::kNear); |
| 359 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); | 359 __ call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
| 360 __ bind(&ok); | 360 __ bind(&ok); |
| 361 } | 361 } |
| 362 | 362 |
| 363 { Comment cmnt(masm_, "[ Body"); | 363 { Comment cmnt(masm_, "[ Body"); |
| 364 DCHECK(loop_depth() == 0); | 364 DCHECK(loop_depth() == 0); |
| 365 VisitStatements(function()->body()); | 365 VisitStatements(literal()->body()); |
| 366 DCHECK(loop_depth() == 0); | 366 DCHECK(loop_depth() == 0); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 | 369 |
| 370 // Always emit a 'return undefined' in case control fell off the end of | 370 // Always emit a 'return undefined' in case control fell off the end of |
| 371 // the body. | 371 // the body. |
| 372 { Comment cmnt(masm_, "[ return <undefined>;"); | 372 { Comment cmnt(masm_, "[ return <undefined>;"); |
| 373 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); | 373 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); |
| 374 EmitReturnSequence(); | 374 EmitReturnSequence(); |
| 375 } | 375 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 EmitProfilingCounterDecrement(weight); | 455 EmitProfilingCounterDecrement(weight); |
| 456 Label ok; | 456 Label ok; |
| 457 __ j(positive, &ok, Label::kNear); | 457 __ j(positive, &ok, Label::kNear); |
| 458 __ Push(rax); | 458 __ Push(rax); |
| 459 __ call(isolate()->builtins()->InterruptCheck(), | 459 __ call(isolate()->builtins()->InterruptCheck(), |
| 460 RelocInfo::CODE_TARGET); | 460 RelocInfo::CODE_TARGET); |
| 461 __ Pop(rax); | 461 __ Pop(rax); |
| 462 EmitProfilingCounterReset(); | 462 EmitProfilingCounterReset(); |
| 463 __ bind(&ok); | 463 __ bind(&ok); |
| 464 | 464 |
| 465 SetReturnPosition(function()); | 465 SetReturnPosition(literal()); |
| 466 int no_frame_start = masm_->pc_offset(); | 466 int no_frame_start = masm_->pc_offset(); |
| 467 __ leave(); | 467 __ leave(); |
| 468 | 468 |
| 469 int arg_count = info_->scope()->num_parameters() + 1; | 469 int arg_count = info_->scope()->num_parameters() + 1; |
| 470 int arguments_bytes = arg_count * kPointerSize; | 470 int arguments_bytes = arg_count * kPointerSize; |
| 471 __ Ret(arguments_bytes, rcx); | 471 __ Ret(arguments_bytes, rcx); |
| 472 | 472 |
| 473 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 473 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 474 } | 474 } |
| 475 } | 475 } |
| (...skipping 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5301 Assembler::target_address_at(call_target_address, | 5301 Assembler::target_address_at(call_target_address, |
| 5302 unoptimized_code)); | 5302 unoptimized_code)); |
| 5303 return OSR_AFTER_STACK_CHECK; | 5303 return OSR_AFTER_STACK_CHECK; |
| 5304 } | 5304 } |
| 5305 | 5305 |
| 5306 | 5306 |
| 5307 } // namespace internal | 5307 } // namespace internal |
| 5308 } // namespace v8 | 5308 } // namespace v8 |
| 5309 | 5309 |
| 5310 #endif // V8_TARGET_ARCH_X64 | 5310 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |