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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 3384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3395 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) { | 3395 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) { |
3396 // Get the global object, then the native context | 3396 // Get the global object, then the native context |
3397 HInstruction* context = Add<HLoadNamedField>( | 3397 HInstruction* context = Add<HLoadNamedField>( |
3398 closure, nullptr, HObjectAccess::ForFunctionContextPointer()); | 3398 closure, nullptr, HObjectAccess::ForFunctionContextPointer()); |
3399 return Add<HLoadNamedField>( | 3399 return Add<HLoadNamedField>( |
3400 context, nullptr, | 3400 context, nullptr, |
3401 HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX)); | 3401 HObjectAccess::ForContextSlot(Context::NATIVE_CONTEXT_INDEX)); |
3402 } | 3402 } |
3403 | 3403 |
3404 | 3404 |
3405 HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) { | |
3406 HValue* native_context = BuildGetNativeContext(); | |
3407 HValue* script_context_table = Add<HLoadNamedField>( | |
3408 native_context, nullptr, | |
3409 HObjectAccess::ForContextSlot(Context::SCRIPT_CONTEXT_TABLE_INDEX)); | |
3410 return Add<HLoadNamedField>(script_context_table, nullptr, | |
3411 HObjectAccess::ForScriptContext(context_index)); | |
3412 } | |
3413 | |
3414 | |
3415 HValue* HGraphBuilder::BuildGetParentContext(HValue* depth, int depth_value) { | 3405 HValue* HGraphBuilder::BuildGetParentContext(HValue* depth, int depth_value) { |
3416 HValue* script_context = context(); | 3406 HValue* script_context = context(); |
3417 if (depth != NULL) { | 3407 if (depth != NULL) { |
3418 HValue* zero = graph()->GetConstant0(); | 3408 HValue* zero = graph()->GetConstant0(); |
3419 | 3409 |
3420 Push(script_context); | 3410 Push(script_context); |
3421 Push(depth); | 3411 Push(depth); |
3422 | 3412 |
3423 LoopBuilder loop(this); | 3413 LoopBuilder loop(this); |
3424 loop.BeginBody(2); // Drop script_context and depth from last environment | 3414 loop.BeginBody(2); // Drop script_context and depth from last environment |
(...skipping 9970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13395 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13385 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13396 } | 13386 } |
13397 | 13387 |
13398 #ifdef DEBUG | 13388 #ifdef DEBUG |
13399 graph_->Verify(false); // No full verify. | 13389 graph_->Verify(false); // No full verify. |
13400 #endif | 13390 #endif |
13401 } | 13391 } |
13402 | 13392 |
13403 } // namespace internal | 13393 } // namespace internal |
13404 } // namespace v8 | 13394 } // namespace v8 |
OLD | NEW |