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

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

Issue 1539034: Add inline caches for loading non-existing 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::ComputeLoadNonExisting(String* name, JSObject* receiver) {
97 // The code stub for loading non-existing properties can be reused
98 // for all names, so we use the empty_string as the name in the map
99 // code cache.
100 Code::Flags flags =
101 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NON_EXISTING);
102 Object* code = receiver->map()->FindInCodeCache(Heap::empty_string(), flags);
103 if (code->IsUndefined()) {
104 LoadStubCompiler compiler;
105 code = compiler.CompileLoadNonExisting(receiver);
106 if (code->IsFailure()) return code;
107 PROFILE(CodeCreateEvent(Logger::LOAD_IC_TAG,
108 Code::cast(code),
109 Heap::empty_string()));
110 Object* result = receiver->map()->UpdateCodeCache(Heap::empty_string(),
111 Code::cast(code));
112 if (result->IsFailure()) return result;
113 }
114 return Set(name, receiver->map(), Code::cast(code));
115 }
116
117
96 Object* StubCache::ComputeLoadField(String* name, 118 Object* StubCache::ComputeLoadField(String* name,
97 JSObject* receiver, 119 JSObject* receiver,
98 JSObject* holder, 120 JSObject* holder,
99 int field_index) { 121 int field_index) {
100 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); 122 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD);
101 Object* code = receiver->map()->FindInCodeCache(name, flags); 123 Object* code = receiver->map()->FindInCodeCache(name, flags);
102 if (code->IsUndefined()) { 124 if (code->IsUndefined()) {
103 LoadStubCompiler compiler; 125 LoadStubCompiler compiler;
104 code = compiler.CompileLoadField(receiver, holder, field_index, name); 126 code = compiler.CompileLoadField(receiver, holder, field_index, name);
105 if (code->IsFailure()) return code; 127 if (code->IsFailure()) return code;
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 if (!result->IsFailure()) { 1148 if (!result->IsFailure()) {
1127 Code* code = Code::cast(result); 1149 Code* code = Code::cast(result);
1128 USE(code); 1150 USE(code);
1129 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); 1151 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub"));
1130 } 1152 }
1131 return result; 1153 return result;
1132 } 1154 }
1133 1155
1134 1156
1135 } } // namespace v8::internal 1157 } } // namespace v8::internal
OLDNEW
« src/stub-cache.h ('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