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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 CompilationInfo* info = info_; | 94 CompilationInfo* info = info_; |
95 profiling_counter_ = isolate()->factory()->NewCell( | 95 profiling_counter_ = isolate()->factory()->NewCell( |
96 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 96 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
97 SetFunctionPosition(function()); | 97 SetFunctionPosition(function()); |
98 Comment cmnt(masm_, "[ function compiled by full code generator"); | 98 Comment cmnt(masm_, "[ function compiled by full code generator"); |
99 | 99 |
100 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 100 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
101 | 101 |
102 #ifdef DEBUG | 102 #ifdef DEBUG |
103 if (strlen(FLAG_stop_at) > 0 && | 103 if (strlen(FLAG_stop_at) > 0 && |
104 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 104 function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
105 __ int3(); | 105 __ int3(); |
106 } | 106 } |
107 #endif | 107 #endif |
108 | 108 |
109 // Sloppy mode functions and builtins need to replace the receiver with the | 109 // Sloppy mode functions and builtins need to replace the receiver with the |
110 // global proxy when called as functions (without an explicit receiver | 110 // global proxy when called as functions (without an explicit receiver |
111 // object). | 111 // object). |
112 if (is_sloppy(info->language_mode()) && !info->is_native() && | 112 if (is_sloppy(info->language_mode()) && !info->is_native() && |
113 info->MayUseThis()) { | 113 info->MayUseThis()) { |
114 Label ok; | 114 Label ok; |
(...skipping 17 matching lines...) Expand all Loading... |
132 // the frame (that is done below). | 132 // the frame (that is done below). |
133 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 133 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
134 | 134 |
135 info->set_prologue_offset(masm_->pc_offset()); | 135 info->set_prologue_offset(masm_->pc_offset()); |
136 __ Prologue(info->IsCodePreAgingActive()); | 136 __ Prologue(info->IsCodePreAgingActive()); |
137 info->AddNoFrameRange(0, masm_->pc_offset()); | 137 info->AddNoFrameRange(0, masm_->pc_offset()); |
138 | 138 |
139 { Comment cmnt(masm_, "[ Allocate locals"); | 139 { Comment cmnt(masm_, "[ Allocate locals"); |
140 int locals_count = info->scope()->num_stack_slots(); | 140 int locals_count = info->scope()->num_stack_slots(); |
141 // Generators allocate locals, if any, in context slots. | 141 // Generators allocate locals, if any, in context slots. |
142 DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0); | 142 DCHECK(!IsGeneratorFunction(function()->kind()) || locals_count == 0); |
143 if (locals_count == 1) { | 143 if (locals_count == 1) { |
144 __ push(Immediate(isolate()->factory()->undefined_value())); | 144 __ push(Immediate(isolate()->factory()->undefined_value())); |
145 } else if (locals_count > 1) { | 145 } else if (locals_count > 1) { |
146 if (locals_count >= 128) { | 146 if (locals_count >= 128) { |
147 Label ok; | 147 Label ok; |
148 __ mov(ecx, esp); | 148 __ mov(ecx, esp); |
149 __ sub(ecx, Immediate(locals_count * kPointerSize)); | 149 __ sub(ecx, Immediate(locals_count * kPointerSize)); |
150 ExternalReference stack_limit = | 150 ExternalReference stack_limit = |
151 ExternalReference::address_of_real_stack_limit(isolate()); | 151 ExternalReference::address_of_real_stack_limit(isolate()); |
152 __ cmp(ecx, Operand::StaticVariable(stack_limit)); | 152 __ cmp(ecx, Operand::StaticVariable(stack_limit)); |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 // | 1405 // |
1406 // The condition on the declaration scopes is a conservative check for | 1406 // The condition on the declaration scopes is a conservative check for |
1407 // nested functions that access a binding and are called before the | 1407 // nested functions that access a binding and are called before the |
1408 // binding is initialized: | 1408 // binding is initialized: |
1409 // function() { f(); let x = 1; function f() { x = 2; } } | 1409 // function() { f(); let x = 1; function f() { x = 2; } } |
1410 // | 1410 // |
1411 bool skip_init_check; | 1411 bool skip_init_check; |
1412 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { | 1412 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
1413 skip_init_check = false; | 1413 skip_init_check = false; |
1414 } else if (var->is_this()) { | 1414 } else if (var->is_this()) { |
1415 CHECK(info_->function() != nullptr && | 1415 CHECK(function() != nullptr && |
1416 (info_->function()->kind() & kSubclassConstructor) != 0); | 1416 (function()->kind() & kSubclassConstructor) != 0); |
1417 // TODO(dslomov): implement 'this' hole check elimination. | 1417 // TODO(dslomov): implement 'this' hole check elimination. |
1418 skip_init_check = false; | 1418 skip_init_check = false; |
1419 } else { | 1419 } else { |
1420 // Check that we always have valid source position. | 1420 // Check that we always have valid source position. |
1421 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); | 1421 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
1422 DCHECK(proxy->position() != RelocInfo::kNoPosition); | 1422 DCHECK(proxy->position() != RelocInfo::kNoPosition); |
1423 skip_init_check = var->mode() != CONST_LEGACY && | 1423 skip_init_check = var->mode() != CONST_LEGACY && |
1424 var->initializer_position() < proxy->position(); | 1424 var->initializer_position() < proxy->position(); |
1425 } | 1425 } |
1426 | 1426 |
(...skipping 3864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5291 Assembler::target_address_at(call_target_address, | 5291 Assembler::target_address_at(call_target_address, |
5292 unoptimized_code)); | 5292 unoptimized_code)); |
5293 return OSR_AFTER_STACK_CHECK; | 5293 return OSR_AFTER_STACK_CHECK; |
5294 } | 5294 } |
5295 | 5295 |
5296 | 5296 |
5297 } // namespace internal | 5297 } // namespace internal |
5298 } // namespace v8 | 5298 } // namespace v8 |
5299 | 5299 |
5300 #endif // V8_TARGET_ARCH_IA32 | 5300 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |