| 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 5300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5311 // load from a global cell for them. | 5311 // load from a global cell for them. |
| 5312 Handle<Object> constant_value = | 5312 Handle<Object> constant_value = |
| 5313 isolate()->factory()->GlobalConstantFor(variable->name()); | 5313 isolate()->factory()->GlobalConstantFor(variable->name()); |
| 5314 if (!constant_value.is_null()) { | 5314 if (!constant_value.is_null()) { |
| 5315 HConstant* instr = New<HConstant>(constant_value); | 5315 HConstant* instr = New<HConstant>(constant_value); |
| 5316 return ast_context()->ReturnInstruction(instr, expr->id()); | 5316 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 5317 } | 5317 } |
| 5318 | 5318 |
| 5319 Handle<GlobalObject> global(current_info()->global_object()); | 5319 Handle<GlobalObject> global(current_info()->global_object()); |
| 5320 | 5320 |
| 5321 if (FLAG_harmony_scoping) { | 5321 // Lookup in script contexts. |
| 5322 { |
| 5322 Handle<ScriptContextTable> script_contexts( | 5323 Handle<ScriptContextTable> script_contexts( |
| 5323 global->native_context()->script_context_table()); | 5324 global->native_context()->script_context_table()); |
| 5324 ScriptContextTable::LookupResult lookup; | 5325 ScriptContextTable::LookupResult lookup; |
| 5325 if (ScriptContextTable::Lookup(script_contexts, variable->name(), | 5326 if (ScriptContextTable::Lookup(script_contexts, variable->name(), |
| 5326 &lookup)) { | 5327 &lookup)) { |
| 5327 Handle<Context> script_context = ScriptContextTable::GetContext( | 5328 Handle<Context> script_context = ScriptContextTable::GetContext( |
| 5328 script_contexts, lookup.context_index); | 5329 script_contexts, lookup.context_index); |
| 5329 Handle<Object> current_value = | 5330 Handle<Object> current_value = |
| 5330 FixedArray::get(script_context, lookup.slot_index); | 5331 FixedArray::get(script_context, lookup.slot_index); |
| 5331 | 5332 |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6471 | 6472 |
| 6472 // Because not every expression has a position and there is not common | 6473 // Because not every expression has a position and there is not common |
| 6473 // superclass of Assignment and CountOperation, we cannot just pass the | 6474 // superclass of Assignment and CountOperation, we cannot just pass the |
| 6474 // owning expression instead of position and ast_id separately. | 6475 // owning expression instead of position and ast_id separately. |
| 6475 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( | 6476 void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( |
| 6476 Variable* var, | 6477 Variable* var, |
| 6477 HValue* value, | 6478 HValue* value, |
| 6478 BailoutId ast_id) { | 6479 BailoutId ast_id) { |
| 6479 Handle<GlobalObject> global(current_info()->global_object()); | 6480 Handle<GlobalObject> global(current_info()->global_object()); |
| 6480 | 6481 |
| 6481 if (FLAG_harmony_scoping) { | 6482 // Lookup in script contexts. |
| 6483 { |
| 6482 Handle<ScriptContextTable> script_contexts( | 6484 Handle<ScriptContextTable> script_contexts( |
| 6483 global->native_context()->script_context_table()); | 6485 global->native_context()->script_context_table()); |
| 6484 ScriptContextTable::LookupResult lookup; | 6486 ScriptContextTable::LookupResult lookup; |
| 6485 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { | 6487 if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) { |
| 6486 if (lookup.mode == CONST) { | 6488 if (lookup.mode == CONST) { |
| 6487 return Bailout(kNonInitializerAssignmentToConst); | 6489 return Bailout(kNonInitializerAssignmentToConst); |
| 6488 } | 6490 } |
| 6489 Handle<Context> script_context = | 6491 Handle<Context> script_context = |
| 6490 ScriptContextTable::GetContext(script_contexts, lookup.context_index); | 6492 ScriptContextTable::GetContext(script_contexts, lookup.context_index); |
| 6491 | 6493 |
| (...skipping 6896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13388 if (ShouldProduceTraceOutput()) { | 13390 if (ShouldProduceTraceOutput()) { |
| 13389 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13391 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13390 } | 13392 } |
| 13391 | 13393 |
| 13392 #ifdef DEBUG | 13394 #ifdef DEBUG |
| 13393 graph_->Verify(false); // No full verify. | 13395 graph_->Verify(false); // No full verify. |
| 13394 #endif | 13396 #endif |
| 13395 } | 13397 } |
| 13396 | 13398 |
| 13397 } } // namespace v8::internal | 13399 } } // namespace v8::internal |
| OLD | NEW |