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/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 12742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12753 void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { | 12753 void HOptimizedGraphBuilder::GenerateDebugIsActive(CallRuntime* call) { |
12754 DCHECK(call->arguments()->length() == 0); | 12754 DCHECK(call->arguments()->length() == 0); |
12755 HValue* ref = | 12755 HValue* ref = |
12756 Add<HConstant>(ExternalReference::debug_is_active_address(isolate())); | 12756 Add<HConstant>(ExternalReference::debug_is_active_address(isolate())); |
12757 HValue* value = | 12757 HValue* value = |
12758 Add<HLoadNamedField>(ref, nullptr, HObjectAccess::ForExternalUInteger8()); | 12758 Add<HLoadNamedField>(ref, nullptr, HObjectAccess::ForExternalUInteger8()); |
12759 return ast_context()->ReturnValue(value); | 12759 return ast_context()->ReturnValue(value); |
12760 } | 12760 } |
12761 | 12761 |
12762 | 12762 |
12763 void HOptimizedGraphBuilder::GenerateGetPrototype(CallRuntime* call) { | |
12764 DCHECK(call->arguments()->length() == 1); | |
12765 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | |
12766 HValue* object = Pop(); | |
12767 | |
12768 NoObservableSideEffectsScope no_effects(this); | |
12769 | |
12770 HValue* map = Add<HLoadNamedField>(object, nullptr, HObjectAccess::ForMap()); | |
12771 HValue* bit_field = | |
12772 Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForMapBitField()); | |
12773 HValue* is_access_check_needed_mask = | |
12774 Add<HConstant>(1 << Map::kIsAccessCheckNeeded); | |
12775 HValue* is_access_check_needed_test = AddUncasted<HBitwise>( | |
12776 Token::BIT_AND, bit_field, is_access_check_needed_mask); | |
12777 | |
12778 HValue* proto = | |
12779 Add<HLoadNamedField>(map, nullptr, HObjectAccess::ForPrototype()); | |
12780 HValue* proto_map = | |
12781 Add<HLoadNamedField>(proto, nullptr, HObjectAccess::ForMap()); | |
12782 HValue* proto_bit_field = | |
12783 Add<HLoadNamedField>(proto_map, nullptr, HObjectAccess::ForMapBitField()); | |
12784 HValue* is_hidden_prototype_mask = | |
12785 Add<HConstant>(1 << Map::kIsHiddenPrototype); | |
12786 HValue* is_hidden_prototype_test = AddUncasted<HBitwise>( | |
12787 Token::BIT_AND, proto_bit_field, is_hidden_prototype_mask); | |
12788 | |
12789 { | |
12790 IfBuilder needs_runtime(this); | |
12791 needs_runtime.If<HCompareNumericAndBranch>( | |
12792 is_access_check_needed_test, graph()->GetConstant0(), Token::NE); | |
12793 needs_runtime.OrIf<HCompareNumericAndBranch>( | |
12794 is_hidden_prototype_test, graph()->GetConstant0(), Token::NE); | |
12795 | |
12796 needs_runtime.Then(); | |
12797 { | |
12798 Add<HPushArguments>(object); | |
12799 Push( | |
12800 Add<HCallRuntime>(Runtime::FunctionForId(Runtime::kGetPrototype), 1)); | |
12801 } | |
12802 | |
12803 needs_runtime.Else(); | |
12804 Push(proto); | |
12805 } | |
12806 return ast_context()->ReturnValue(Pop()); | |
12807 } | |
12808 | |
12809 | |
12810 #undef CHECK_BAILOUT | 12763 #undef CHECK_BAILOUT |
12811 #undef CHECK_ALIVE | 12764 #undef CHECK_ALIVE |
12812 | 12765 |
12813 | 12766 |
12814 HEnvironment::HEnvironment(HEnvironment* outer, | 12767 HEnvironment::HEnvironment(HEnvironment* outer, |
12815 Scope* scope, | 12768 Scope* scope, |
12816 Handle<JSFunction> closure, | 12769 Handle<JSFunction> closure, |
12817 Zone* zone) | 12770 Zone* zone) |
12818 : closure_(closure), | 12771 : closure_(closure), |
12819 values_(0, zone), | 12772 values_(0, zone), |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13434 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13387 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13435 } | 13388 } |
13436 | 13389 |
13437 #ifdef DEBUG | 13390 #ifdef DEBUG |
13438 graph_->Verify(false); // No full verify. | 13391 graph_->Verify(false); // No full verify. |
13439 #endif | 13392 #endif |
13440 } | 13393 } |
13441 | 13394 |
13442 } // namespace internal | 13395 } // namespace internal |
13443 } // namespace v8 | 13396 } // namespace v8 |
OLD | NEW |