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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5790 PropertyAccessInfo* info, | 5790 PropertyAccessInfo* info, |
5791 HValue* checked_object) { | 5791 HValue* checked_object) { |
5792 // See if this is a load for an immutable property | 5792 // See if this is a load for an immutable property |
5793 if (checked_object->ActualValue()->IsConstant() && | 5793 if (checked_object->ActualValue()->IsConstant() && |
5794 info->lookup()->IsCacheable() && | 5794 info->lookup()->IsCacheable() && |
5795 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { | 5795 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { |
5796 Handle<Object> object( | 5796 Handle<Object> object( |
5797 HConstant::cast(checked_object->ActualValue())->handle(isolate())); | 5797 HConstant::cast(checked_object->ActualValue())->handle(isolate())); |
5798 | 5798 |
5799 if (object->IsJSObject()) { | 5799 if (object->IsJSObject()) { |
5800 LookupResult lookup(isolate()); | 5800 LookupIterator it(object, info->name(), LookupIterator::CHECK_PROPERTY); |
5801 Handle<JSObject>::cast(object)->Lookup(info->name(), &lookup); | 5801 Handle<Object> value = JSObject::GetDataProperty(&it); |
5802 Handle<Object> value(lookup.GetLazyValue(), isolate()); | 5802 CHECK(it.IsFound()); |
5803 | |
5804 DCHECK(!value->IsTheHole()); | |
5805 return New<HConstant>(value); | 5803 return New<HConstant>(value); |
5806 } | 5804 } |
5807 } | 5805 } |
5808 | 5806 |
5809 HObjectAccess access = info->access(); | 5807 HObjectAccess access = info->access(); |
5810 if (access.representation().IsDouble()) { | 5808 if (access.representation().IsDouble()) { |
5811 // Load the heap number. | 5809 // Load the heap number. |
5812 checked_object = Add<HLoadNamedField>( | 5810 checked_object = Add<HLoadNamedField>( |
5813 checked_object, static_cast<HValue*>(NULL), | 5811 checked_object, static_cast<HValue*>(NULL), |
5814 access.WithRepresentation(Representation::Tagged())); | 5812 access.WithRepresentation(Representation::Tagged())); |
(...skipping 4873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10688 // residing in new space. If it is we assume that the function will stay the | 10686 // residing in new space. If it is we assume that the function will stay the |
10689 // same. | 10687 // same. |
10690 Handle<JSFunction> target = Handle<JSFunction>::null(); | 10688 Handle<JSFunction> target = Handle<JSFunction>::null(); |
10691 VariableProxy* proxy = expr->right()->AsVariableProxy(); | 10689 VariableProxy* proxy = expr->right()->AsVariableProxy(); |
10692 bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated(); | 10690 bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated(); |
10693 if (global_function && | 10691 if (global_function && |
10694 current_info()->has_global_object() && | 10692 current_info()->has_global_object() && |
10695 !current_info()->global_object()->IsAccessCheckNeeded()) { | 10693 !current_info()->global_object()->IsAccessCheckNeeded()) { |
10696 Handle<String> name = proxy->name(); | 10694 Handle<String> name = proxy->name(); |
10697 Handle<GlobalObject> global(current_info()->global_object()); | 10695 Handle<GlobalObject> global(current_info()->global_object()); |
10698 LookupResult lookup(isolate()); | 10696 LookupIterator it(global, name, LookupIterator::CHECK_PROPERTY); |
10699 global->Lookup(name, &lookup); | 10697 Handle<Object> value = JSObject::GetDataProperty(&it); |
10700 if (lookup.IsNormal() && lookup.GetValue()->IsJSFunction()) { | 10698 if (it.IsFound() && value->IsJSFunction()) { |
10701 Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue())); | 10699 Handle<JSFunction> candidate = Handle<JSFunction>::cast(value); |
10702 // If the function is in new space we assume it's more likely to | 10700 // If the function is in new space we assume it's more likely to |
10703 // change and thus prefer the general IC code. | 10701 // change and thus prefer the general IC code. |
10704 if (!isolate()->heap()->InNewSpace(*candidate)) { | 10702 if (!isolate()->heap()->InNewSpace(*candidate)) { |
10705 target = candidate; | 10703 target = candidate; |
10706 } | 10704 } |
10707 } | 10705 } |
10708 } | 10706 } |
10709 | 10707 |
10710 // If the target is not null we have found a known global function that is | 10708 // If the target is not null we have found a known global function that is |
10711 // assumed to stay the same for this instanceof. | 10709 // assumed to stay the same for this instanceof. |
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12488 if (ShouldProduceTraceOutput()) { | 12486 if (ShouldProduceTraceOutput()) { |
12489 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12487 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12490 } | 12488 } |
12491 | 12489 |
12492 #ifdef DEBUG | 12490 #ifdef DEBUG |
12493 graph_->Verify(false); // No full verify. | 12491 graph_->Verify(false); // No full verify. |
12494 #endif | 12492 #endif |
12495 } | 12493 } |
12496 | 12494 |
12497 } } // namespace v8::internal | 12495 } } // namespace v8::internal |
OLD | NEW |