OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3998 HRegExpLiteral* instr = new(zone()) HRegExpLiteral(context, | 3998 HRegExpLiteral* instr = new(zone()) HRegExpLiteral(context, |
3999 literals, | 3999 literals, |
4000 expr->pattern(), | 4000 expr->pattern(), |
4001 expr->flags(), | 4001 expr->flags(), |
4002 expr->literal_index()); | 4002 expr->literal_index()); |
4003 return ast_context()->ReturnInstruction(instr, expr->id()); | 4003 return ast_context()->ReturnInstruction(instr, expr->id()); |
4004 } | 4004 } |
4005 | 4005 |
4006 | 4006 |
4007 static bool CanInlinePropertyAccess(Map* type) { | 4007 static bool CanInlinePropertyAccess(Map* type) { |
4008 return type->IsJSObjectMap() && | 4008 return !type->is_dictionary_map() && !type->has_named_interceptor(); |
4009 !type->is_dictionary_map() && | |
4010 !type->has_named_interceptor(); | |
4011 } | 4009 } |
4012 | 4010 |
4013 | 4011 |
4014 static void LookupInPrototypes(Handle<Map> map, | 4012 static void LookupInPrototypes(Handle<Map> map, |
4015 Handle<String> name, | 4013 Handle<String> name, |
4016 LookupResult* lookup) { | 4014 LookupResult* lookup) { |
4017 while (map->prototype()->IsJSObject()) { | 4015 while (map->prototype()->IsJSObject()) { |
4018 Handle<JSObject> holder(JSObject::cast(map->prototype())); | 4016 Handle<JSObject> holder(JSObject::cast(map->prototype())); |
4019 map = Handle<Map>(holder->map()); | 4017 map = Handle<Map>(holder->map()); |
4020 if (!CanInlinePropertyAccess(*map)) break; | 4018 if (!CanInlinePropertyAccess(*map)) break; |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5387 checked_object, HObjectAccess::ForField(map, &lookup, name)); | 5385 checked_object, HObjectAccess::ForField(map, &lookup, name)); |
5388 } | 5386 } |
5389 | 5387 |
5390 // Handle a load of a constant known function. | 5388 // Handle a load of a constant known function. |
5391 if (lookup.IsConstant()) { | 5389 if (lookup.IsConstant()) { |
5392 AddCheckMap(object, map); | 5390 AddCheckMap(object, map); |
5393 Handle<Object> constant(lookup.GetConstantFromMap(*map), isolate()); | 5391 Handle<Object> constant(lookup.GetConstantFromMap(*map), isolate()); |
5394 return New<HConstant>(constant); | 5392 return New<HConstant>(constant); |
5395 } | 5393 } |
5396 | 5394 |
5397 if (lookup.IsFound()) { | |
5398 // Cannot handle the property, do a generic load instead. | |
5399 HValue* context = environment()->context(); | |
5400 return new(zone()) HLoadNamedGeneric(context, object, name); | |
5401 } | |
5402 | |
5403 // Handle a load from a known field somewhere in the prototype chain. | 5395 // Handle a load from a known field somewhere in the prototype chain. |
5404 LookupInPrototypes(map, name, &lookup); | 5396 LookupInPrototypes(map, name, &lookup); |
5405 if (lookup.IsField()) { | 5397 if (lookup.IsField()) { |
5406 Handle<JSObject> prototype(JSObject::cast(map->prototype())); | 5398 Handle<JSObject> prototype(JSObject::cast(map->prototype())); |
5407 Handle<JSObject> holder(lookup.holder()); | 5399 Handle<JSObject> holder(lookup.holder()); |
5408 Handle<Map> holder_map(holder->map()); | 5400 Handle<Map> holder_map(holder->map()); |
5409 AddCheckMap(object, map); | 5401 AddCheckMap(object, map); |
5410 HValue* checked_holder = BuildCheckPrototypeMaps(prototype, holder); | 5402 HValue* checked_holder = BuildCheckPrototypeMaps(prototype, holder); |
5411 return BuildLoadNamedField( | 5403 return BuildLoadNamedField( |
5412 checked_holder, HObjectAccess::ForField(holder_map, &lookup, name)); | 5404 checked_holder, HObjectAccess::ForField(holder_map, &lookup, name)); |
(...skipping 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9688 if (ShouldProduceTraceOutput()) { | 9680 if (ShouldProduceTraceOutput()) { |
9689 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9681 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9690 } | 9682 } |
9691 | 9683 |
9692 #ifdef DEBUG | 9684 #ifdef DEBUG |
9693 graph_->Verify(false); // No full verify. | 9685 graph_->Verify(false); // No full verify. |
9694 #endif | 9686 #endif |
9695 } | 9687 } |
9696 | 9688 |
9697 } } // namespace v8::internal | 9689 } } // namespace v8::internal |
OLD | NEW |