| 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 #include "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 5340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5351 PropertyCell::AddDependentCompilationInfo(cell, top_info()); | 5351 PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
| 5352 if (it.property_details().cell_type() == PropertyCellType::kConstant) { | 5352 if (it.property_details().cell_type() == PropertyCellType::kConstant) { |
| 5353 Handle<Object> constant_object(cell->value(), isolate()); | 5353 Handle<Object> constant_object(cell->value(), isolate()); |
| 5354 if (constant_object->IsConsString()) { | 5354 if (constant_object->IsConsString()) { |
| 5355 constant_object = | 5355 constant_object = |
| 5356 String::Flatten(Handle<String>::cast(constant_object)); | 5356 String::Flatten(Handle<String>::cast(constant_object)); |
| 5357 } | 5357 } |
| 5358 HConstant* constant = New<HConstant>(constant_object); | 5358 HConstant* constant = New<HConstant>(constant_object); |
| 5359 return ast_context()->ReturnInstruction(constant, expr->id()); | 5359 return ast_context()->ReturnInstruction(constant, expr->id()); |
| 5360 } else { | 5360 } else { |
| 5361 HLoadGlobalCell* instr = | 5361 HConstant* cell_constant = Add<HConstant>(cell); |
| 5362 New<HLoadGlobalCell>(cell, it.property_details()); | 5362 HLoadNamedField* instr = New<HLoadNamedField>( |
| 5363 cell_constant, nullptr, HObjectAccess::ForPropertyCellValue()); |
| 5364 instr->ClearDependsOnFlag(kInobjectFields); |
| 5365 instr->SetDependsOnFlag(kGlobalVars); |
| 5363 return ast_context()->ReturnInstruction(instr, expr->id()); | 5366 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 5364 } | 5367 } |
| 5365 } else { | 5368 } else { |
| 5366 HValue* global_object = Add<HLoadNamedField>( | 5369 HValue* global_object = Add<HLoadNamedField>( |
| 5367 context(), nullptr, | 5370 context(), nullptr, |
| 5368 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 5371 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
| 5369 HLoadGlobalGeneric* instr = | 5372 HLoadGlobalGeneric* instr = |
| 5370 New<HLoadGlobalGeneric>(global_object, | 5373 New<HLoadGlobalGeneric>(global_object, |
| 5371 variable->name(), | 5374 variable->name(), |
| 5372 ast_context()->is_for_typeof()); | 5375 ast_context()->is_for_typeof()); |
| (...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6531 } else { | 6534 } else { |
| 6532 builder.If<HCompareObjectEqAndBranch>(value, c_constant); | 6535 builder.If<HCompareObjectEqAndBranch>(value, c_constant); |
| 6533 } | 6536 } |
| 6534 builder.Then(); | 6537 builder.Then(); |
| 6535 builder.Else(); | 6538 builder.Else(); |
| 6536 Add<HDeoptimize>(Deoptimizer::kConstantGlobalVariableAssignment, | 6539 Add<HDeoptimize>(Deoptimizer::kConstantGlobalVariableAssignment, |
| 6537 Deoptimizer::EAGER); | 6540 Deoptimizer::EAGER); |
| 6538 builder.End(); | 6541 builder.End(); |
| 6539 } | 6542 } |
| 6540 } | 6543 } |
| 6541 HInstruction* instr = | 6544 HConstant* cell_constant = Add<HConstant>(cell); |
| 6542 Add<HStoreGlobalCell>(value, cell, it.property_details()); | 6545 HInstruction* instr = Add<HStoreNamedField>( |
| 6546 cell_constant, HObjectAccess::ForPropertyCellValue(), value); |
| 6547 instr->ClearChangesFlag(kInobjectFields); |
| 6548 instr->SetChangesFlag(kGlobalVars); |
| 6543 if (instr->HasObservableSideEffects()) { | 6549 if (instr->HasObservableSideEffects()) { |
| 6544 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6550 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
| 6545 } | 6551 } |
| 6546 } else { | 6552 } else { |
| 6547 HValue* global_object = Add<HLoadNamedField>( | 6553 HValue* global_object = Add<HLoadNamedField>( |
| 6548 context(), nullptr, | 6554 context(), nullptr, |
| 6549 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 6555 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
| 6550 HStoreNamedGeneric* instr = | 6556 HStoreNamedGeneric* instr = |
| 6551 Add<HStoreNamedGeneric>(global_object, var->name(), value, | 6557 Add<HStoreNamedGeneric>(global_object, var->name(), value, |
| 6552 function_language_mode(), PREMONOMORPHIC); | 6558 function_language_mode(), PREMONOMORPHIC); |
| (...skipping 6837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13390 if (ShouldProduceTraceOutput()) { | 13396 if (ShouldProduceTraceOutput()) { |
| 13391 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13397 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13392 } | 13398 } |
| 13393 | 13399 |
| 13394 #ifdef DEBUG | 13400 #ifdef DEBUG |
| 13395 graph_->Verify(false); // No full verify. | 13401 graph_->Verify(false); // No full verify. |
| 13396 #endif | 13402 #endif |
| 13397 } | 13403 } |
| 13398 | 13404 |
| 13399 } } // namespace v8::internal | 13405 } } // namespace v8::internal |
| OLD | NEW |