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

Side by Side Diff: src/stub-cache.cc

Issue 1559033: Reapply load ICs for nonexistent properties.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 8 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 *secondary = *primary; 86 *secondary = *primary;
87 } 87 }
88 88
89 // Update primary cache. 89 // Update primary cache.
90 primary->key = name; 90 primary->key = name;
91 primary->value = code; 91 primary->value = code;
92 return code; 92 return code;
93 } 93 }
94 94
95 95
96 Object* StubCache::ComputeLoadNonexistent(String* name, JSObject* receiver) {
97 // If no global objects are present in the prototype chain, the load
98 // nonexistent IC stub can be shared for all names for a given map
99 // and we use the empty string for the map cache in that case. If
100 // there are global objects involved, we need to check global
101 // property cells in the stub and therefore the stub will be
102 // specific to the name.
103 String* cache_name = Heap::empty_string();
104 if (receiver->IsGlobalObject()) cache_name = name;
105 JSObject* last = receiver;
106 while (last->GetPrototype() != Heap::null_value()) {
107 last = JSObject::cast(last->GetPrototype());
108 if (last->IsGlobalObject()) cache_name = name;
109 }
110 // Compile the stub that is either shared for all names or
111 // name specific if there are global objects involved.
112 Code::Flags flags =
113 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT);
114 Object* code = receiver->map()->FindInCodeCache(cache_name, flags);
115 if (code->IsUndefined()) {
116 LoadStubCompiler compiler;
117 code = compiler.CompileLoadNonexistent(cache_name, receiver, last);
118 if (code->IsFailure()) return code;
119 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), cache_name));
120 Object* result =
121 receiver->map()->UpdateCodeCache(cache_name, Code::cast(code));
122 if (result->IsFailure()) return result;
123 }
124 return Set(name, receiver->map(), Code::cast(code));
125 }
126
127
96 Object* StubCache::ComputeLoadField(String* name, 128 Object* StubCache::ComputeLoadField(String* name,
97 JSObject* receiver, 129 JSObject* receiver,
98 JSObject* holder, 130 JSObject* holder,
99 int field_index) { 131 int field_index) {
100 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); 132 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD);
101 Object* code = receiver->map()->FindInCodeCache(name, flags); 133 Object* code = receiver->map()->FindInCodeCache(name, flags);
102 if (code->IsUndefined()) { 134 if (code->IsUndefined()) {
103 LoadStubCompiler compiler; 135 LoadStubCompiler compiler;
104 code = compiler.CompileLoadField(receiver, holder, field_index, name); 136 code = compiler.CompileLoadField(receiver, holder, field_index, name);
105 if (code->IsFailure()) return code; 137 if (code->IsFailure()) return code;
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 if (!result->IsFailure()) { 1158 if (!result->IsFailure()) {
1127 Code* code = Code::cast(result); 1159 Code* code = Code::cast(result);
1128 USE(code); 1160 USE(code);
1129 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); 1161 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub"));
1130 } 1162 }
1131 return result; 1163 return result;
1132 } 1164 }
1133 1165
1134 1166
1135 } } // namespace v8::internal 1167 } } // namespace v8::internal
OLDNEW
« src/ic.cc ('K') | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698