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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(function()); |
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->function()->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 |
107 | 107 |
108 // Sloppy mode functions and builtins need to replace the receiver with the | 108 // Sloppy mode functions and builtins need to replace the receiver with the |
109 // global proxy when called as functions (without an explicit receiver | 109 // global proxy when called as functions (without an explicit receiver |
110 // object). | 110 // object). |
111 if (is_sloppy(info->language_mode()) && !info->is_native() && | 111 if (is_sloppy(info->language_mode()) && !info->is_native() && |
112 info->MayUseThis() && info->scope()->has_this_declaration()) { | 112 info->MayUseThis() && info->scope()->has_this_declaration()) { |
113 Label ok; | 113 Label ok; |
(...skipping 17 matching lines...) Expand all Loading... |
131 // the frame (that is done below). | 131 // the frame (that is done below). |
132 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 132 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
133 | 133 |
134 info->set_prologue_offset(masm_->pc_offset()); | 134 info->set_prologue_offset(masm_->pc_offset()); |
135 __ Prologue(info->IsCodePreAgingActive()); | 135 __ Prologue(info->IsCodePreAgingActive()); |
136 info->AddNoFrameRange(0, masm_->pc_offset()); | 136 info->AddNoFrameRange(0, masm_->pc_offset()); |
137 | 137 |
138 { Comment cmnt(masm_, "[ Allocate locals"); | 138 { Comment cmnt(masm_, "[ Allocate locals"); |
139 int locals_count = info->scope()->num_stack_slots(); | 139 int locals_count = info->scope()->num_stack_slots(); |
140 // Generators allocate locals, if any, in context slots. | 140 // Generators allocate locals, if any, in context slots. |
141 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); | 141 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); |
142 if (locals_count == 1) { | 142 if (locals_count == 1) { |
143 __ PushRoot(Heap::kUndefinedValueRootIndex); | 143 __ PushRoot(Heap::kUndefinedValueRootIndex); |
144 } else if (locals_count > 1) { | 144 } else if (locals_count > 1) { |
145 if (locals_count >= 128) { | 145 if (locals_count >= 128) { |
146 Label ok; | 146 Label ok; |
147 __ movp(rcx, rsp); | 147 __ movp(rcx, rsp); |
148 __ subp(rcx, Immediate(locals_count * kPointerSize)); | 148 __ subp(rcx, Immediate(locals_count * kPointerSize)); |
149 __ CompareRoot(rcx, Heap::kRealStackLimitRootIndex); | 149 __ CompareRoot(rcx, Heap::kRealStackLimitRootIndex); |
150 __ j(above_equal, &ok, Label::kNear); | 150 __ j(above_equal, &ok, Label::kNear); |
151 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 151 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 // | 1434 // |
1435 // The condition on the declaration scopes is a conservative check for | 1435 // The condition on the declaration scopes is a conservative check for |
1436 // nested functions that access a binding and are called before the | 1436 // nested functions that access a binding and are called before the |
1437 // binding is initialized: | 1437 // binding is initialized: |
1438 // function() { f(); let x = 1; function f() { x = 2; } } | 1438 // function() { f(); let x = 1; function f() { x = 2; } } |
1439 // | 1439 // |
1440 bool skip_init_check; | 1440 bool skip_init_check; |
1441 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { | 1441 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
1442 skip_init_check = false; | 1442 skip_init_check = false; |
1443 } else if (var->is_this()) { | 1443 } else if (var->is_this()) { |
1444 CHECK(info_->function() != nullptr && | 1444 CHECK(info_->has_literal() && |
1445 (info_->function()->kind() & kSubclassConstructor) != 0); | 1445 (info_->literal()->kind() & kSubclassConstructor) != 0); |
1446 // TODO(dslomov): implement 'this' hole check elimination. | 1446 // TODO(dslomov): implement 'this' hole check elimination. |
1447 skip_init_check = false; | 1447 skip_init_check = false; |
1448 } else { | 1448 } else { |
1449 // Check that we always have valid source position. | 1449 // Check that we always have valid source position. |
1450 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); | 1450 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
1451 DCHECK(proxy->position() != RelocInfo::kNoPosition); | 1451 DCHECK(proxy->position() != RelocInfo::kNoPosition); |
1452 skip_init_check = var->mode() != CONST_LEGACY && | 1452 skip_init_check = var->mode() != CONST_LEGACY && |
1453 var->initializer_position() < proxy->position(); | 1453 var->initializer_position() < proxy->position(); |
1454 } | 1454 } |
1455 | 1455 |
(...skipping 3845 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 |