OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // - fp: our caller's frame pointer. | 97 // - fp: our caller's frame pointer. |
98 // - jssp: stack pointer. | 98 // - jssp: stack pointer. |
99 // - lr: return address. | 99 // - lr: return address. |
100 // | 100 // |
101 // The function builds a JS frame. See JavaScriptFrameConstants in | 101 // The function builds a JS frame. See JavaScriptFrameConstants in |
102 // frames-arm.h for its layout. | 102 // frames-arm.h for its layout. |
103 void FullCodeGenerator::Generate() { | 103 void FullCodeGenerator::Generate() { |
104 CompilationInfo* info = info_; | 104 CompilationInfo* info = info_; |
105 profiling_counter_ = isolate()->factory()->NewCell( | 105 profiling_counter_ = isolate()->factory()->NewCell( |
106 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 106 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
107 SetFunctionPosition(function()); | 107 SetFunctionPosition(literal()); |
108 Comment cmnt(masm_, "[ Function compiled by full code generator"); | 108 Comment cmnt(masm_, "[ Function compiled by full code generator"); |
109 | 109 |
110 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 110 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
111 | 111 |
112 #ifdef DEBUG | 112 #ifdef DEBUG |
113 if (strlen(FLAG_stop_at) > 0 && | 113 if (strlen(FLAG_stop_at) > 0 && |
114 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 114 info->literal()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
115 __ Debug("stop-at", __LINE__, BREAK); | 115 __ Debug("stop-at", __LINE__, BREAK); |
116 } | 116 } |
117 #endif | 117 #endif |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 __ Mov(x1, Smi::FromInt(num_parameters)); | 318 __ Mov(x1, Smi::FromInt(num_parameters)); |
319 __ Push(x3, x2, x1); | 319 __ Push(x3, x2, x1); |
320 | 320 |
321 // Arguments to ArgumentsAccessStub: | 321 // Arguments to ArgumentsAccessStub: |
322 // function, receiver address, parameter count. | 322 // function, receiver address, parameter count. |
323 // The stub will rewrite receiver and parameter count if the previous | 323 // The stub will rewrite receiver and parameter count if the previous |
324 // stack frame was an arguments adapter frame. | 324 // stack frame was an arguments adapter frame. |
325 ArgumentsAccessStub::Type type; | 325 ArgumentsAccessStub::Type type; |
326 if (is_strict(language_mode()) || !has_simple_parameters()) { | 326 if (is_strict(language_mode()) || !has_simple_parameters()) { |
327 type = ArgumentsAccessStub::NEW_STRICT; | 327 type = ArgumentsAccessStub::NEW_STRICT; |
328 } else if (function()->has_duplicate_parameters()) { | 328 } else if (literal()->has_duplicate_parameters()) { |
329 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 329 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
330 } else { | 330 } else { |
331 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 331 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
332 } | 332 } |
333 ArgumentsAccessStub stub(isolate(), type); | 333 ArgumentsAccessStub stub(isolate(), type); |
334 __ CallStub(&stub); | 334 __ CallStub(&stub); |
335 | 335 |
336 SetVar(arguments, x0, x1, x2); | 336 SetVar(arguments, x0, x1, x2); |
337 } | 337 } |
338 | 338 |
(...skipping 27 matching lines...) Expand all Loading... |
366 __ B(hs, &ok); | 366 __ B(hs, &ok); |
367 PredictableCodeSizeScope predictable(masm_, | 367 PredictableCodeSizeScope predictable(masm_, |
368 Assembler::kCallSizeWithRelocation); | 368 Assembler::kCallSizeWithRelocation); |
369 __ Call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); | 369 __ Call(isolate()->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
370 __ Bind(&ok); | 370 __ Bind(&ok); |
371 } | 371 } |
372 | 372 |
373 { | 373 { |
374 Comment cmnt(masm_, "[ Body"); | 374 Comment cmnt(masm_, "[ Body"); |
375 DCHECK(loop_depth() == 0); | 375 DCHECK(loop_depth() == 0); |
376 VisitStatements(function()->body()); | 376 VisitStatements(literal()->body()); |
377 DCHECK(loop_depth() == 0); | 377 DCHECK(loop_depth() == 0); |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 // Always emit a 'return undefined' in case control fell off the end of | 381 // Always emit a 'return undefined' in case control fell off the end of |
382 // the body. | 382 // the body. |
383 { Comment cmnt(masm_, "[ return <undefined>;"); | 383 { Comment cmnt(masm_, "[ return <undefined>;"); |
384 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); | 384 __ LoadRoot(x0, Heap::kUndefinedValueRootIndex); |
385 } | 385 } |
386 EmitReturnSequence(); | 386 EmitReturnSequence(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 EmitProfilingCounterDecrement(weight); | 478 EmitProfilingCounterDecrement(weight); |
479 Label ok; | 479 Label ok; |
480 __ B(pl, &ok); | 480 __ B(pl, &ok); |
481 __ Push(x0); | 481 __ Push(x0); |
482 __ Call(isolate()->builtins()->InterruptCheck(), | 482 __ Call(isolate()->builtins()->InterruptCheck(), |
483 RelocInfo::CODE_TARGET); | 483 RelocInfo::CODE_TARGET); |
484 __ Pop(x0); | 484 __ Pop(x0); |
485 EmitProfilingCounterReset(); | 485 EmitProfilingCounterReset(); |
486 __ Bind(&ok); | 486 __ Bind(&ok); |
487 | 487 |
488 SetReturnPosition(function()); | 488 SetReturnPosition(literal()); |
489 const Register& current_sp = __ StackPointer(); | 489 const Register& current_sp = __ StackPointer(); |
490 // Nothing ensures 16 bytes alignment here. | 490 // Nothing ensures 16 bytes alignment here. |
491 DCHECK(!current_sp.Is(csp)); | 491 DCHECK(!current_sp.Is(csp)); |
492 __ Mov(current_sp, fp); | 492 __ Mov(current_sp, fp); |
493 int no_frame_start = masm_->pc_offset(); | 493 int no_frame_start = masm_->pc_offset(); |
494 __ Ldp(fp, lr, MemOperand(current_sp, 2 * kXRegSize, PostIndex)); | 494 __ Ldp(fp, lr, MemOperand(current_sp, 2 * kXRegSize, PostIndex)); |
495 // Drop the arguments and receiver and return. | 495 // Drop the arguments and receiver and return. |
496 // TODO(all): This implementation is overkill as it supports 2**31+1 | 496 // TODO(all): This implementation is overkill as it supports 2**31+1 |
497 // arguments, consider how to improve it without creating a security | 497 // arguments, consider how to improve it without creating a security |
498 // hole. | 498 // hole. |
(...skipping 4901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5400 } | 5400 } |
5401 | 5401 |
5402 return INTERRUPT; | 5402 return INTERRUPT; |
5403 } | 5403 } |
5404 | 5404 |
5405 | 5405 |
5406 } // namespace internal | 5406 } // namespace internal |
5407 } // namespace v8 | 5407 } // namespace v8 |
5408 | 5408 |
5409 #endif // V8_TARGET_ARCH_ARM64 | 5409 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |