| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 } | 3200 } |
| 3201 | 3201 |
| 3202 | 3202 |
| 3203 HGraphBuilder::GlobalPropertyAccess HGraphBuilder::LookupGlobalProperty( | 3203 HGraphBuilder::GlobalPropertyAccess HGraphBuilder::LookupGlobalProperty( |
| 3204 Variable* var, LookupResult* lookup, bool is_store) { | 3204 Variable* var, LookupResult* lookup, bool is_store) { |
| 3205 if (var->is_this() || !info()->has_global_object()) { | 3205 if (var->is_this() || !info()->has_global_object()) { |
| 3206 return kUseGeneric; | 3206 return kUseGeneric; |
| 3207 } | 3207 } |
| 3208 Handle<GlobalObject> global(info()->global_object()); | 3208 Handle<GlobalObject> global(info()->global_object()); |
| 3209 global->Lookup(*var->name(), lookup); | 3209 global->Lookup(*var->name(), lookup); |
| 3210 if (!lookup->IsProperty() || | 3210 if (!lookup->IsFound() || |
| 3211 lookup->type() != NORMAL || | 3211 lookup->type() != NORMAL || |
| 3212 (is_store && lookup->IsReadOnly()) || | 3212 (is_store && lookup->IsReadOnly()) || |
| 3213 lookup->holder() != *global) { | 3213 lookup->holder() != *global) { |
| 3214 return kUseGeneric; | 3214 return kUseGeneric; |
| 3215 } | 3215 } |
| 3216 | 3216 |
| 3217 return kUseCell; | 3217 return kUseCell; |
| 3218 } | 3218 } |
| 3219 | 3219 |
| 3220 | 3220 |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 return new(zone()) HLoadNamedGeneric(context, obj, name); | 4152 return new(zone()) HLoadNamedGeneric(context, obj, name); |
| 4153 } | 4153 } |
| 4154 | 4154 |
| 4155 | 4155 |
| 4156 HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj, | 4156 HInstruction* HGraphBuilder::BuildLoadNamed(HValue* obj, |
| 4157 Property* expr, | 4157 Property* expr, |
| 4158 Handle<Map> map, | 4158 Handle<Map> map, |
| 4159 Handle<String> name) { | 4159 Handle<String> name) { |
| 4160 LookupResult lookup(isolate()); | 4160 LookupResult lookup(isolate()); |
| 4161 map->LookupInDescriptors(NULL, *name, &lookup); | 4161 map->LookupInDescriptors(NULL, *name, &lookup); |
| 4162 if (lookup.IsProperty() && lookup.type() == FIELD) { | 4162 if (lookup.IsFound() && lookup.type() == FIELD) { |
| 4163 return BuildLoadNamedField(obj, | 4163 return BuildLoadNamedField(obj, |
| 4164 expr, | 4164 expr, |
| 4165 map, | 4165 map, |
| 4166 &lookup, | 4166 &lookup, |
| 4167 true); | 4167 true); |
| 4168 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { | 4168 } else if (lookup.IsFound() && lookup.type() == CONSTANT_FUNCTION) { |
| 4169 AddInstruction(new(zone()) HCheckNonSmi(obj)); | 4169 AddInstruction(new(zone()) HCheckNonSmi(obj)); |
| 4170 AddInstruction(new(zone()) HCheckMap(obj, map, NULL, | 4170 AddInstruction(new(zone()) HCheckMap(obj, map, NULL, |
| 4171 ALLOW_ELEMENT_TRANSITION_MAPS)); | 4171 ALLOW_ELEMENT_TRANSITION_MAPS)); |
| 4172 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); | 4172 Handle<JSFunction> function(lookup.GetConstantFunctionFromMap(*map)); |
| 4173 return new(zone()) HConstant(function, Representation::Tagged()); | 4173 return new(zone()) HConstant(function, Representation::Tagged()); |
| 4174 } else { | 4174 } else { |
| 4175 return BuildLoadNamedGeneric(obj, expr); | 4175 return BuildLoadNamedGeneric(obj, expr); |
| 4176 } | 4176 } |
| 4177 } | 4177 } |
| 4178 | 4178 |
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6246 Handle<JSFunction> target = Handle<JSFunction>::null(); | 6246 Handle<JSFunction> target = Handle<JSFunction>::null(); |
| 6247 VariableProxy* proxy = expr->right()->AsVariableProxy(); | 6247 VariableProxy* proxy = expr->right()->AsVariableProxy(); |
| 6248 bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated(); | 6248 bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated(); |
| 6249 if (global_function && | 6249 if (global_function && |
| 6250 info()->has_global_object() && | 6250 info()->has_global_object() && |
| 6251 !info()->global_object()->IsAccessCheckNeeded()) { | 6251 !info()->global_object()->IsAccessCheckNeeded()) { |
| 6252 Handle<String> name = proxy->name(); | 6252 Handle<String> name = proxy->name(); |
| 6253 Handle<GlobalObject> global(info()->global_object()); | 6253 Handle<GlobalObject> global(info()->global_object()); |
| 6254 LookupResult lookup(isolate()); | 6254 LookupResult lookup(isolate()); |
| 6255 global->Lookup(*name, &lookup); | 6255 global->Lookup(*name, &lookup); |
| 6256 if (lookup.IsProperty() && | 6256 if (lookup.IsFound() && |
| 6257 lookup.type() == NORMAL && | 6257 lookup.type() == NORMAL && |
| 6258 lookup.GetValue()->IsJSFunction()) { | 6258 lookup.GetValue()->IsJSFunction()) { |
| 6259 Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue())); | 6259 Handle<JSFunction> candidate(JSFunction::cast(lookup.GetValue())); |
| 6260 // If the function is in new space we assume it's more likely to | 6260 // If the function is in new space we assume it's more likely to |
| 6261 // change and thus prefer the general IC code. | 6261 // change and thus prefer the general IC code. |
| 6262 if (!isolate()->heap()->InNewSpace(*candidate)) { | 6262 if (!isolate()->heap()->InNewSpace(*candidate)) { |
| 6263 target = candidate; | 6263 target = candidate; |
| 6264 } | 6264 } |
| 6265 } | 6265 } |
| 6266 } | 6266 } |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7412 } | 7412 } |
| 7413 } | 7413 } |
| 7414 | 7414 |
| 7415 #ifdef DEBUG | 7415 #ifdef DEBUG |
| 7416 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7416 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 7417 if (allocator_ != NULL) allocator_->Verify(); | 7417 if (allocator_ != NULL) allocator_->Verify(); |
| 7418 #endif | 7418 #endif |
| 7419 } | 7419 } |
| 7420 | 7420 |
| 7421 } } // namespace v8::internal | 7421 } } // namespace v8::internal |
| OLD | NEW |