Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(802)

Side by Side Diff: src/hydrogen.cc

Issue 23691056: Handle non-JSObject heap objects using slow-path IC stub guarded by the map. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.h ('k') | src/ic.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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->is_dictionary_map() && !type->has_named_interceptor(); 4008 return type->IsJSObjectMap() &&
4009 !type->is_dictionary_map() &&
4010 !type->has_named_interceptor();
4009 } 4011 }
4010 4012
4011 4013
4012 static void LookupInPrototypes(Handle<Map> map, 4014 static void LookupInPrototypes(Handle<Map> map,
4013 Handle<String> name, 4015 Handle<String> name,
4014 LookupResult* lookup) { 4016 LookupResult* lookup) {
4015 while (map->prototype()->IsJSObject()) { 4017 while (map->prototype()->IsJSObject()) {
4016 Handle<JSObject> holder(JSObject::cast(map->prototype())); 4018 Handle<JSObject> holder(JSObject::cast(map->prototype()));
4017 map = Handle<Map>(holder->map()); 4019 map = Handle<Map>(holder->map());
4018 if (!CanInlinePropertyAccess(*map)) break; 4020 if (!CanInlinePropertyAccess(*map)) break;
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
5385 checked_object, HObjectAccess::ForField(map, &lookup, name)); 5387 checked_object, HObjectAccess::ForField(map, &lookup, name));
5386 } 5388 }
5387 5389
5388 // Handle a load of a constant known function. 5390 // Handle a load of a constant known function.
5389 if (lookup.IsConstant()) { 5391 if (lookup.IsConstant()) {
5390 AddCheckMap(object, map); 5392 AddCheckMap(object, map);
5391 Handle<Object> constant(lookup.GetConstantFromMap(*map), isolate()); 5393 Handle<Object> constant(lookup.GetConstantFromMap(*map), isolate());
5392 return New<HConstant>(constant); 5394 return New<HConstant>(constant);
5393 } 5395 }
5394 5396
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
5395 // Handle a load from a known field somewhere in the prototype chain. 5403 // Handle a load from a known field somewhere in the prototype chain.
5396 LookupInPrototypes(map, name, &lookup); 5404 LookupInPrototypes(map, name, &lookup);
5397 if (lookup.IsField()) { 5405 if (lookup.IsField()) {
5398 Handle<JSObject> prototype(JSObject::cast(map->prototype())); 5406 Handle<JSObject> prototype(JSObject::cast(map->prototype()));
5399 Handle<JSObject> holder(lookup.holder()); 5407 Handle<JSObject> holder(lookup.holder());
5400 Handle<Map> holder_map(holder->map()); 5408 Handle<Map> holder_map(holder->map());
5401 AddCheckMap(object, map); 5409 AddCheckMap(object, map);
5402 HValue* checked_holder = BuildCheckPrototypeMaps(prototype, holder); 5410 HValue* checked_holder = BuildCheckPrototypeMaps(prototype, holder);
5403 return BuildLoadNamedField( 5411 return BuildLoadNamedField(
5404 checked_holder, HObjectAccess::ForField(holder_map, &lookup, name)); 5412 checked_holder, HObjectAccess::ForField(holder_map, &lookup, name));
(...skipping 4275 matching lines...) Expand 10 before | Expand all | Expand 10 after
9680 if (ShouldProduceTraceOutput()) { 9688 if (ShouldProduceTraceOutput()) {
9681 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9689 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9682 } 9690 }
9683 9691
9684 #ifdef DEBUG 9692 #ifdef DEBUG
9685 graph_->Verify(false); // No full verify. 9693 graph_->Verify(false); // No full verify.
9686 #endif 9694 #endif
9687 } 9695 }
9688 9696
9689 } } // namespace v8::internal 9697 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698