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 "hydrogen.h" | 5 #include "hydrogen.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "v8.h" | 9 #include "v8.h" |
10 #include "allocation-site-scopes.h" | 10 #include "allocation-site-scopes.h" |
(...skipping 4829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4840 } | 4840 } |
4841 | 4841 |
4842 | 4842 |
4843 HOptimizedGraphBuilder::GlobalPropertyAccess | 4843 HOptimizedGraphBuilder::GlobalPropertyAccess |
4844 HOptimizedGraphBuilder::LookupGlobalProperty( | 4844 HOptimizedGraphBuilder::LookupGlobalProperty( |
4845 Variable* var, LookupResult* lookup, PropertyAccessType access_type) { | 4845 Variable* var, LookupResult* lookup, PropertyAccessType access_type) { |
4846 if (var->is_this() || !current_info()->has_global_object()) { | 4846 if (var->is_this() || !current_info()->has_global_object()) { |
4847 return kUseGeneric; | 4847 return kUseGeneric; |
4848 } | 4848 } |
4849 Handle<GlobalObject> global(current_info()->global_object()); | 4849 Handle<GlobalObject> global(current_info()->global_object()); |
4850 global->Lookup(*var->name(), lookup); | 4850 global->Lookup(var->name(), lookup); |
4851 if (!lookup->IsNormal() || | 4851 if (!lookup->IsNormal() || |
4852 (access_type == STORE && lookup->IsReadOnly()) || | 4852 (access_type == STORE && lookup->IsReadOnly()) || |
4853 lookup->holder() != *global) { | 4853 lookup->holder() != *global) { |
4854 return kUseGeneric; | 4854 return kUseGeneric; |
4855 } | 4855 } |
4856 | 4856 |
4857 return kUseCell; | 4857 return kUseCell; |
4858 } | 4858 } |
4859 | 4859 |
4860 | 4860 |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5325 HValue* checked_object) { | 5325 HValue* checked_object) { |
5326 // See if this is a load for an immutable property | 5326 // See if this is a load for an immutable property |
5327 if (checked_object->ActualValue()->IsConstant() && | 5327 if (checked_object->ActualValue()->IsConstant() && |
5328 info->lookup()->IsCacheable() && | 5328 info->lookup()->IsCacheable() && |
5329 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { | 5329 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) { |
5330 Handle<Object> object( | 5330 Handle<Object> object( |
5331 HConstant::cast(checked_object->ActualValue())->handle(isolate())); | 5331 HConstant::cast(checked_object->ActualValue())->handle(isolate())); |
5332 | 5332 |
5333 if (object->IsJSObject()) { | 5333 if (object->IsJSObject()) { |
5334 LookupResult lookup(isolate()); | 5334 LookupResult lookup(isolate()); |
5335 Handle<JSObject>::cast(object)->Lookup(*info->name(), &lookup); | 5335 Handle<JSObject>::cast(object)->Lookup(info->name(), &lookup); |
5336 Handle<Object> value(lookup.GetLazyValue(), isolate()); | 5336 Handle<Object> value(lookup.GetLazyValue(), isolate()); |
5337 | 5337 |
5338 if (!value->IsTheHole()) { | 5338 if (!value->IsTheHole()) { |
5339 return New<HConstant>(value); | 5339 return New<HConstant>(value); |
5340 } | 5340 } |
5341 } | 5341 } |
5342 } | 5342 } |
5343 | 5343 |
5344 HObjectAccess access = info->access(); | 5344 HObjectAccess access = info->access(); |
5345 if (access.representation().IsDouble()) { | 5345 if (access.representation().IsDouble()) { |
(...skipping 4526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9872 // same. | 9872 // same. |
9873 Handle<JSFunction> target = Handle<JSFunction>::null(); | 9873 Handle<JSFunction> target = Handle<JSFunction>::null(); |
9874 VariableProxy* proxy = expr->right()->AsVariableProxy(); | 9874 VariableProxy* proxy = expr->right()->AsVariableProxy(); |
9875 bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated(); | 9875 bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated(); |
9876 if (global_function && | 9876 if (global_function && |
9877 current_info()->has_global_object() && | 9877 current_info()->has_global_object() && |
9878 !current_info()->global_object()->IsAccessCheckNeeded()) { | 9878 !current_info()->global_object()->IsAccessCheckNeeded()) { |
9879 Handle<String> name = proxy->name(); | 9879 Handle<String> name = proxy->name(); |
9880 Handle<GlobalObject> global(current_info()->global_object()); | 9880 Handle<GlobalObject> global(current_info()->global_object()); |
9881 LookupResult lookup(isolate()); | 9881 LookupResult lookup(isolate()); |
9882 global->Lookup(*name, &lookup); | 9882 global->Lookup(name, &lookup); |
9883 if (lookup.IsNormal() && lookup.GetValue()->IsJSFunction()) { | 9883 if (lookup.IsNormal() && lookup.GetValue()->IsJSFunction()) { |
9884 Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue())); | 9884 Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue())); |
9885 // If the function is in new space we assume it's more likely to | 9885 // If the function is in new space we assume it's more likely to |
9886 // change and thus prefer the general IC code. | 9886 // change and thus prefer the general IC code. |
9887 if (!isolate()->heap()->InNewSpace(*candidate)) { | 9887 if (!isolate()->heap()->InNewSpace(*candidate)) { |
9888 target = candidate; | 9888 target = candidate; |
9889 } | 9889 } |
9890 } | 9890 } |
9891 } | 9891 } |
9892 | 9892 |
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11666 if (ShouldProduceTraceOutput()) { | 11666 if (ShouldProduceTraceOutput()) { |
11667 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11667 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11668 } | 11668 } |
11669 | 11669 |
11670 #ifdef DEBUG | 11670 #ifdef DEBUG |
11671 graph_->Verify(false); // No full verify. | 11671 graph_->Verify(false); // No full verify. |
11672 #endif | 11672 #endif |
11673 } | 11673 } |
11674 | 11674 |
11675 } } // namespace v8::internal | 11675 } } // namespace v8::internal |
OLD | NEW |