| 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 #include "src/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 InitializeAstVisitor(info_->isolate()); | 163 InitializeAstVisitor(info_->isolate()); |
| 164 masm_->set_emit_debug_code(FLAG_debug_code); | 164 masm_->set_emit_debug_code(FLAG_debug_code); |
| 165 masm_->set_predictable_code_size(true); | 165 masm_->set_predictable_code_size(true); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void FullCodeGenerator::PrepareForBailout(Expression* node, | 168 void FullCodeGenerator::PrepareForBailout(Expression* node, |
| 169 BailoutState state) { | 169 BailoutState state) { |
| 170 PrepareForBailoutForId(node->id(), state); | 170 PrepareForBailoutForId(node->id(), state); |
| 171 } | 171 } |
| 172 | 172 |
| 173 | 173 void FullCodeGenerator::CallLoadIC(TypeFeedbackId id) { |
| 174 void FullCodeGenerator::CallLoadIC(TypeofMode typeof_mode, | 174 Handle<Code> ic = CodeFactory::LoadIC(isolate()).code(); |
| 175 TypeFeedbackId id) { | |
| 176 Handle<Code> ic = CodeFactory::LoadIC(isolate(), typeof_mode).code(); | |
| 177 CallIC(ic, id); | 175 CallIC(ic, id); |
| 178 } | 176 } |
| 179 | 177 |
| 178 void FullCodeGenerator::CallLoadGlobalIC(TypeofMode typeof_mode, |
| 179 TypeFeedbackId id) { |
| 180 Handle<Code> ic = CodeFactory::LoadGlobalIC(isolate(), typeof_mode).code(); |
| 181 CallIC(ic, id); |
| 182 } |
| 180 | 183 |
| 181 void FullCodeGenerator::CallStoreIC(TypeFeedbackId id) { | 184 void FullCodeGenerator::CallStoreIC(TypeFeedbackId id) { |
| 182 Handle<Code> ic = CodeFactory::StoreIC(isolate(), language_mode()).code(); | 185 Handle<Code> ic = CodeFactory::StoreIC(isolate(), language_mode()).code(); |
| 183 CallIC(ic, id); | 186 CallIC(ic, id); |
| 184 } | 187 } |
| 185 | 188 |
| 186 | 189 |
| 187 void FullCodeGenerator::RecordJSReturnSite(Call* call) { | 190 void FullCodeGenerator::RecordJSReturnSite(Call* call) { |
| 188 // We record the offset of the function return so we can rebuild the frame | 191 // We record the offset of the function return so we can rebuild the frame |
| 189 // if the function was inlined, i.e., this is the return address in the | 192 // if the function was inlined, i.e., this is the return address in the |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 | 1055 |
| 1053 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1056 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 1054 SetExpressionPosition(prop); | 1057 SetExpressionPosition(prop); |
| 1055 Literal* key = prop->key()->AsLiteral(); | 1058 Literal* key = prop->key()->AsLiteral(); |
| 1056 DCHECK(!key->value()->IsSmi()); | 1059 DCHECK(!key->value()->IsSmi()); |
| 1057 DCHECK(!prop->IsSuperAccess()); | 1060 DCHECK(!prop->IsSuperAccess()); |
| 1058 | 1061 |
| 1059 __ Move(LoadDescriptor::NameRegister(), key->value()); | 1062 __ Move(LoadDescriptor::NameRegister(), key->value()); |
| 1060 __ Move(LoadDescriptor::SlotRegister(), | 1063 __ Move(LoadDescriptor::SlotRegister(), |
| 1061 SmiFromSlot(prop->PropertyFeedbackSlot())); | 1064 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 1062 CallLoadIC(NOT_INSIDE_TYPEOF); | 1065 CallLoadIC(); |
| 1063 } | 1066 } |
| 1064 | 1067 |
| 1065 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 1068 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
| 1066 // Stack: receiver, home_object | 1069 // Stack: receiver, home_object |
| 1067 SetExpressionPosition(prop); | 1070 SetExpressionPosition(prop); |
| 1068 Literal* key = prop->key()->AsLiteral(); | 1071 Literal* key = prop->key()->AsLiteral(); |
| 1069 DCHECK(!key->value()->IsSmi()); | 1072 DCHECK(!key->value()->IsSmi()); |
| 1070 DCHECK(prop->IsSuperAccess()); | 1073 DCHECK(prop->IsSuperAccess()); |
| 1071 | 1074 |
| 1072 PushOperand(key->value()); | 1075 PushOperand(key->value()); |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 | 1518 |
| 1516 CallRuntimeWithOperands(Runtime::kDefineClass); | 1519 CallRuntimeWithOperands(Runtime::kDefineClass); |
| 1517 PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1520 PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER); |
| 1518 PushOperand(result_register()); | 1521 PushOperand(result_register()); |
| 1519 | 1522 |
| 1520 // Load the "prototype" from the constructor. | 1523 // Load the "prototype" from the constructor. |
| 1521 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); | 1524 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); |
| 1522 __ LoadRoot(LoadDescriptor::NameRegister(), | 1525 __ LoadRoot(LoadDescriptor::NameRegister(), |
| 1523 Heap::kprototype_stringRootIndex); | 1526 Heap::kprototype_stringRootIndex); |
| 1524 __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot())); | 1527 __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot())); |
| 1525 CallLoadIC(NOT_INSIDE_TYPEOF); | 1528 CallLoadIC(); |
| 1526 PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER); | 1529 PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER); |
| 1527 PushOperand(result_register()); | 1530 PushOperand(result_register()); |
| 1528 | 1531 |
| 1529 EmitClassDefineProperties(lit); | 1532 EmitClassDefineProperties(lit); |
| 1530 DropOperands(1); | 1533 DropOperands(1); |
| 1531 | 1534 |
| 1532 // Set the constructor to have fast properties. | 1535 // Set the constructor to have fast properties. |
| 1533 CallRuntimeWithOperands(Runtime::kToFastProperties); | 1536 CallRuntimeWithOperands(Runtime::kToFastProperties); |
| 1534 | 1537 |
| 1535 if (lit->class_variable_proxy() != nullptr) { | 1538 if (lit->class_variable_proxy() != nullptr) { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 return var->scope()->is_nonlinear() || | 1977 return var->scope()->is_nonlinear() || |
| 1975 var->initializer_position() >= proxy->position(); | 1978 var->initializer_position() >= proxy->position(); |
| 1976 } | 1979 } |
| 1977 | 1980 |
| 1978 | 1981 |
| 1979 #undef __ | 1982 #undef __ |
| 1980 | 1983 |
| 1981 | 1984 |
| 1982 } // namespace internal | 1985 } // namespace internal |
| 1983 } // namespace v8 | 1986 } // namespace v8 |
| OLD | NEW |