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 12372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12383 void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { | 12383 void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { |
12384 DCHECK(call->arguments()->length() == 0); | 12384 DCHECK(call->arguments()->length() == 0); |
12385 HValue* ref = | 12385 HValue* ref = |
12386 Add<HConstant>(ExternalReference::debug_is_active_address(isolate())); | 12386 Add<HConstant>(ExternalReference::debug_is_active_address(isolate())); |
12387 HValue* value = Add<HLoadNamedField>( | 12387 HValue* value = Add<HLoadNamedField>( |
12388 ref, static_cast<HValue*>(NULL), HObjectAccess::ForExternalUInteger8()); | 12388 ref, static_cast<HValue*>(NULL), HObjectAccess::ForExternalUInteger8()); |
12389 return ast_context()->ReturnValue(value); | 12389 return ast_context()->ReturnValue(value); |
12390 } | 12390 } |
12391 | 12391 |
12392 | 12392 |
| 12393 void HOptimizedGraphBuilder::GenerateGetPrototype(CallRuntime* call) { |
| 12394 DCHECK(call->arguments()->length() == 1); |
| 12395 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
| 12396 HValue* object = Pop(); |
| 12397 |
| 12398 NoObservableSideEffectsScope no_effects(this); |
| 12399 |
| 12400 HValue* map = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), |
| 12401 HObjectAccess::ForMap()); |
| 12402 HValue* bit_field = Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), |
| 12403 HObjectAccess::ForMapBitField()); |
| 12404 HValue* is_access_check_needed_mask = |
| 12405 Add<HConstant>(1 << Map::kIsAccessCheckNeeded); |
| 12406 HValue* is_access_check_needed_test = AddUncasted<HBitwise>( |
| 12407 Token::BIT_AND, bit_field, is_access_check_needed_mask); |
| 12408 |
| 12409 HValue* proto = Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), |
| 12410 HObjectAccess::ForPrototype()); |
| 12411 HValue* proto_map = Add<HLoadNamedField>(proto, static_cast<HValue*>(NULL), |
| 12412 HObjectAccess::ForMap()); |
| 12413 HValue* proto_bit_field = Add<HLoadNamedField>( |
| 12414 proto_map, static_cast<HValue*>(NULL), HObjectAccess::ForMapBitField()); |
| 12415 HValue* is_hidden_prototype_mask = |
| 12416 Add<HConstant>(1 << Map::kIsHiddenPrototype); |
| 12417 HValue* is_hidden_prototype_test = AddUncasted<HBitwise>( |
| 12418 Token::BIT_AND, proto_bit_field, is_hidden_prototype_mask); |
| 12419 |
| 12420 { |
| 12421 IfBuilder needs_runtime(this); |
| 12422 needs_runtime.If<HCompareNumericAndBranch>( |
| 12423 is_access_check_needed_test, graph()->GetConstant0(), Token::NE); |
| 12424 needs_runtime.OrIf<HCompareNumericAndBranch>( |
| 12425 is_hidden_prototype_test, graph()->GetConstant0(), Token::NE); |
| 12426 |
| 12427 needs_runtime.Then(); |
| 12428 { |
| 12429 Add<HPushArguments>(object); |
| 12430 Push(Add<HCallRuntime>( |
| 12431 call->name(), Runtime::FunctionForId(Runtime::kGetPrototype), 1)); |
| 12432 } |
| 12433 |
| 12434 needs_runtime.Else(); |
| 12435 Push(proto); |
| 12436 } |
| 12437 return ast_context()->ReturnValue(Pop()); |
| 12438 } |
| 12439 |
| 12440 |
12393 #undef CHECK_BAILOUT | 12441 #undef CHECK_BAILOUT |
12394 #undef CHECK_ALIVE | 12442 #undef CHECK_ALIVE |
12395 | 12443 |
12396 | 12444 |
12397 HEnvironment::HEnvironment(HEnvironment* outer, | 12445 HEnvironment::HEnvironment(HEnvironment* outer, |
12398 Scope* scope, | 12446 Scope* scope, |
12399 Handle<JSFunction> closure, | 12447 Handle<JSFunction> closure, |
12400 Zone* zone) | 12448 Zone* zone) |
12401 : closure_(closure), | 12449 : closure_(closure), |
12402 values_(0, zone), | 12450 values_(0, zone), |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13020 if (ShouldProduceTraceOutput()) { | 13068 if (ShouldProduceTraceOutput()) { |
13021 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13069 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13022 } | 13070 } |
13023 | 13071 |
13024 #ifdef DEBUG | 13072 #ifdef DEBUG |
13025 graph_->Verify(false); // No full verify. | 13073 graph_->Verify(false); // No full verify. |
13026 #endif | 13074 #endif |
13027 } | 13075 } |
13028 | 13076 |
13029 } } // namespace v8::internal | 13077 } } // namespace v8::internal |
OLD | NEW |