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 5330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5341 return ast_context()->ReturnInstruction(result, expr->id()); | 5341 return ast_context()->ReturnInstruction(result, expr->id()); |
5342 } | 5342 } |
5343 } | 5343 } |
5344 | 5344 |
5345 LookupIterator it(global, variable->name(), | 5345 LookupIterator it(global, variable->name(), |
5346 LookupIterator::OWN_SKIP_INTERCEPTOR); | 5346 LookupIterator::OWN_SKIP_INTERCEPTOR); |
5347 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); | 5347 GlobalPropertyAccess type = LookupGlobalProperty(variable, &it, LOAD); |
5348 | 5348 |
5349 if (type == kUseCell) { | 5349 if (type == kUseCell) { |
5350 Handle<PropertyCell> cell = it.GetPropertyCell(); | 5350 Handle<PropertyCell> cell = it.GetPropertyCell(); |
5351 if (cell->type()->IsConstant()) { | 5351 PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
5352 PropertyCell::AddDependentCompilationInfo(cell, top_info()); | 5352 if (it.property_details().cell_type() == PropertyCellType::kConstant) { |
5353 Handle<Object> constant_object = cell->type()->AsConstant()->Value(); | 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 HLoadGlobalCell* instr = |
5362 New<HLoadGlobalCell>(cell, it.property_details()); | 5362 New<HLoadGlobalCell>(cell, it.property_details()); |
5363 return ast_context()->ReturnInstruction(instr, expr->id()); | 5363 return ast_context()->ReturnInstruction(instr, expr->id()); |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6507 DCHECK(instr->HasObservableSideEffects()); | 6507 DCHECK(instr->HasObservableSideEffects()); |
6508 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6508 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
6509 return; | 6509 return; |
6510 } | 6510 } |
6511 } | 6511 } |
6512 | 6512 |
6513 LookupIterator it(global, var->name(), LookupIterator::OWN_SKIP_INTERCEPTOR); | 6513 LookupIterator it(global, var->name(), LookupIterator::OWN_SKIP_INTERCEPTOR); |
6514 GlobalPropertyAccess type = LookupGlobalProperty(var, &it, STORE); | 6514 GlobalPropertyAccess type = LookupGlobalProperty(var, &it, STORE); |
6515 if (type == kUseCell) { | 6515 if (type == kUseCell) { |
6516 Handle<PropertyCell> cell = it.GetPropertyCell(); | 6516 Handle<PropertyCell> cell = it.GetPropertyCell(); |
6517 if (cell->type()->IsConstant()) { | 6517 PropertyCell::AddDependentCompilationInfo(cell, top_info()); |
6518 Handle<Object> constant = cell->type()->AsConstant()->Value(); | 6518 if (it.property_details().cell_type() == PropertyCellType::kConstant) { |
| 6519 Handle<Object> constant(cell->value(), isolate()); |
6519 if (value->IsConstant()) { | 6520 if (value->IsConstant()) { |
6520 HConstant* c_value = HConstant::cast(value); | 6521 HConstant* c_value = HConstant::cast(value); |
6521 if (!constant.is_identical_to(c_value->handle(isolate()))) { | 6522 if (!constant.is_identical_to(c_value->handle(isolate()))) { |
6522 Add<HDeoptimize>(Deoptimizer::kConstantGlobalVariableAssignment, | 6523 Add<HDeoptimize>(Deoptimizer::kConstantGlobalVariableAssignment, |
6523 Deoptimizer::EAGER); | 6524 Deoptimizer::EAGER); |
6524 } | 6525 } |
6525 } else { | 6526 } else { |
6526 HValue* c_constant = Add<HConstant>(constant); | 6527 HValue* c_constant = Add<HConstant>(constant); |
6527 IfBuilder builder(this); | 6528 IfBuilder builder(this); |
6528 if (constant->IsNumber()) { | 6529 if (constant->IsNumber()) { |
(...skipping 6860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13389 if (ShouldProduceTraceOutput()) { | 13390 if (ShouldProduceTraceOutput()) { |
13390 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13391 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13391 } | 13392 } |
13392 | 13393 |
13393 #ifdef DEBUG | 13394 #ifdef DEBUG |
13394 graph_->Verify(false); // No full verify. | 13395 graph_->Verify(false); // No full verify. |
13395 #endif | 13396 #endif |
13396 } | 13397 } |
13397 | 13398 |
13398 } } // namespace v8::internal | 13399 } } // namespace v8::internal |
OLD | NEW |