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

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

Issue 12226090: Order arguments of ComputeMonomorphicFlags to match ComputeFlags. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 10 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/objects-inl.h ('k') | src/type-info.cc » ('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 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (current->IsGlobalObject()) { 118 if (current->IsGlobalObject()) {
119 global = Handle<GlobalObject>::cast(current); 119 global = Handle<GlobalObject>::cast(current);
120 cache_name = name; 120 cache_name = name;
121 } else if (!current->HasFastProperties()) { 121 } else if (!current->HasFastProperties()) {
122 cache_name = name; 122 cache_name = name;
123 } 123 }
124 } while (!next->IsNull()); 124 } while (!next->IsNull());
125 125
126 // Compile the stub that is either shared for all names or 126 // Compile the stub that is either shared for all names or
127 // name specific if there are global objects involved. 127 // name specific if there are global objects involved.
128 Code::Flags flags = 128 Code::Flags flags = Code::ComputeMonomorphicFlags(
129 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NONEXISTENT); 129 Code::LOAD_IC, Code::kNoExtraICState, Code::NONEXISTENT);
130 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags), 130 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags),
131 isolate_); 131 isolate_);
132 if (probe->IsCode()) return Handle<Code>::cast(probe); 132 if (probe->IsCode()) return Handle<Code>::cast(probe);
133 133
134 LoadStubCompiler compiler(isolate_); 134 LoadStubCompiler compiler(isolate_);
135 Handle<Code> code = 135 Handle<Code> code =
136 compiler.CompileLoadNonexistent(receiver, current, cache_name, global); 136 compiler.CompileLoadNonexistent(receiver, current, cache_name, global);
137 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name)); 137 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name));
138 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code)); 138 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code));
139 JSObject::UpdateMapCodeCache(receiver, cache_name, code); 139 JSObject::UpdateMapCodeCache(receiver, cache_name, code);
140 return code; 140 return code;
141 } 141 }
142 142
143 143
144 Handle<Code> StubCache::ComputeLoadField(Handle<String> name, 144 Handle<Code> StubCache::ComputeLoadField(Handle<String> name,
145 Handle<JSObject> receiver, 145 Handle<JSObject> receiver,
146 Handle<JSObject> holder, 146 Handle<JSObject> holder,
147 PropertyIndex field) { 147 PropertyIndex field) {
148 InlineCacheHolderFlag cache_holder = 148 InlineCacheHolderFlag cache_holder =
149 IC::GetCodeCacheForObject(*receiver, *holder); 149 IC::GetCodeCacheForObject(*receiver, *holder);
150 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 150 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
151 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::FIELD); 151 Code::Flags flags = Code::ComputeMonomorphicFlags(
152 Code::LOAD_IC, Code::kNoExtraICState, Code::FIELD);
152 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 153 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
153 isolate_); 154 isolate_);
154 if (probe->IsCode()) return Handle<Code>::cast(probe); 155 if (probe->IsCode()) return Handle<Code>::cast(probe);
155 156
156 LoadStubCompiler compiler(isolate_); 157 LoadStubCompiler compiler(isolate_);
157 Handle<Code> code = compiler.CompileLoadField(receiver, holder, name, field); 158 Handle<Code> code = compiler.CompileLoadField(receiver, holder, name, field);
158 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 159 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
159 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 160 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
160 JSObject::UpdateMapCodeCache(map_holder, name, code); 161 JSObject::UpdateMapCodeCache(map_holder, name, code);
161 return code; 162 return code;
162 } 163 }
163 164
164 165
165 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, 166 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name,
166 Handle<JSObject> receiver, 167 Handle<JSObject> receiver,
167 Handle<JSObject> holder, 168 Handle<JSObject> holder,
168 Handle<AccessorInfo> callback) { 169 Handle<AccessorInfo> callback) {
169 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); 170 ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
170 InlineCacheHolderFlag cache_holder = 171 InlineCacheHolderFlag cache_holder =
171 IC::GetCodeCacheForObject(*receiver, *holder); 172 IC::GetCodeCacheForObject(*receiver, *holder);
172 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 173 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
173 Code::Flags flags = 174 Code::Flags flags = Code::ComputeMonomorphicFlags(
174 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); 175 Code::LOAD_IC, Code::kNoExtraICState, Code::CALLBACKS);
175 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 176 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
176 isolate_); 177 isolate_);
177 if (probe->IsCode()) return Handle<Code>::cast(probe); 178 if (probe->IsCode()) return Handle<Code>::cast(probe);
178 179
179 LoadStubCompiler compiler(isolate_); 180 LoadStubCompiler compiler(isolate_);
180 Handle<Code> code = 181 Handle<Code> code =
181 compiler.CompileLoadCallback(receiver, holder, name, callback); 182 compiler.CompileLoadCallback(receiver, holder, name, callback);
182 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 183 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
183 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 184 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
184 JSObject::UpdateMapCodeCache(map_holder, name, code); 185 JSObject::UpdateMapCodeCache(map_holder, name, code);
185 return code; 186 return code;
186 } 187 }
187 188
188 189
189 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name, 190 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name,
190 Handle<JSObject> receiver, 191 Handle<JSObject> receiver,
191 Handle<JSObject> holder, 192 Handle<JSObject> holder,
192 Handle<JSFunction> getter) { 193 Handle<JSFunction> getter) {
193 InlineCacheHolderFlag cache_holder = 194 InlineCacheHolderFlag cache_holder =
194 IC::GetCodeCacheForObject(*receiver, *holder); 195 IC::GetCodeCacheForObject(*receiver, *holder);
195 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 196 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
196 Code::Flags flags = 197 Code::Flags flags = Code::ComputeMonomorphicFlags(
197 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); 198 Code::LOAD_IC, Code::kNoExtraICState, Code::CALLBACKS);
198 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 199 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
199 isolate_); 200 isolate_);
200 if (probe->IsCode()) return Handle<Code>::cast(probe); 201 if (probe->IsCode()) return Handle<Code>::cast(probe);
201 202
202 LoadStubCompiler compiler(isolate_); 203 LoadStubCompiler compiler(isolate_);
203 Handle<Code> code = 204 Handle<Code> code =
204 compiler.CompileLoadViaGetter(receiver, holder, name, getter); 205 compiler.CompileLoadViaGetter(receiver, holder, name, getter);
205 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 206 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
206 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 207 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
207 JSObject::UpdateMapCodeCache(map_holder, name, code); 208 JSObject::UpdateMapCodeCache(map_holder, name, code);
208 return code; 209 return code;
209 } 210 }
210 211
211 212
212 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, 213 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name,
213 Handle<JSObject> receiver, 214 Handle<JSObject> receiver,
214 Handle<JSObject> holder, 215 Handle<JSObject> holder,
215 Handle<JSFunction> value) { 216 Handle<JSFunction> value) {
216 InlineCacheHolderFlag cache_holder = 217 InlineCacheHolderFlag cache_holder =
217 IC::GetCodeCacheForObject(*receiver, *holder); 218 IC::GetCodeCacheForObject(*receiver, *holder);
218 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 219 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
219 Code::Flags flags = 220 Code::Flags flags = Code::ComputeMonomorphicFlags(
220 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CONSTANT_FUNCTION); 221 Code::LOAD_IC, Code::kNoExtraICState, Code::CONSTANT_FUNCTION);
221 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 222 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
222 isolate_); 223 isolate_);
223 if (probe->IsCode()) return Handle<Code>::cast(probe); 224 if (probe->IsCode()) return Handle<Code>::cast(probe);
224 225
225 LoadStubCompiler compiler(isolate_); 226 LoadStubCompiler compiler(isolate_);
226 Handle<Code> code = 227 Handle<Code> code =
227 compiler.CompileLoadConstant(receiver, holder, name, value); 228 compiler.CompileLoadConstant(receiver, holder, name, value);
228 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 229 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
229 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 230 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
230 JSObject::UpdateMapCodeCache(map_holder, name, code); 231 JSObject::UpdateMapCodeCache(map_holder, name, code);
231 return code; 232 return code;
232 } 233 }
233 234
234 235
235 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name, 236 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name,
236 Handle<JSObject> receiver, 237 Handle<JSObject> receiver,
237 Handle<JSObject> holder) { 238 Handle<JSObject> holder) {
238 InlineCacheHolderFlag cache_holder = 239 InlineCacheHolderFlag cache_holder =
239 IC::GetCodeCacheForObject(*receiver, *holder); 240 IC::GetCodeCacheForObject(*receiver, *holder);
240 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 241 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
241 Code::Flags flags = 242 Code::Flags flags = Code::ComputeMonomorphicFlags(
242 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::INTERCEPTOR); 243 Code::LOAD_IC, Code::kNoExtraICState, Code::INTERCEPTOR);
243 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 244 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
244 isolate_); 245 isolate_);
245 if (probe->IsCode()) return Handle<Code>::cast(probe); 246 if (probe->IsCode()) return Handle<Code>::cast(probe);
246 247
247 LoadStubCompiler compiler(isolate_); 248 LoadStubCompiler compiler(isolate_);
248 Handle<Code> code = 249 Handle<Code> code =
249 compiler.CompileLoadInterceptor(receiver, holder, name); 250 compiler.CompileLoadInterceptor(receiver, holder, name);
250 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 251 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
251 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 252 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
252 JSObject::UpdateMapCodeCache(map_holder, name, code); 253 JSObject::UpdateMapCodeCache(map_holder, name, code);
253 return code; 254 return code;
254 } 255 }
255 256
256 257
257 Handle<Code> StubCache::ComputeLoadNormal() { 258 Handle<Code> StubCache::ComputeLoadNormal() {
258 return isolate_->builtins()->LoadIC_Normal(); 259 return isolate_->builtins()->LoadIC_Normal();
259 } 260 }
260 261
261 262
262 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name, 263 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name,
263 Handle<JSObject> receiver, 264 Handle<JSObject> receiver,
264 Handle<GlobalObject> holder, 265 Handle<GlobalObject> holder,
265 Handle<JSGlobalPropertyCell> cell, 266 Handle<JSGlobalPropertyCell> cell,
266 bool is_dont_delete) { 267 bool is_dont_delete) {
267 InlineCacheHolderFlag cache_holder = 268 InlineCacheHolderFlag cache_holder =
268 IC::GetCodeCacheForObject(*receiver, *holder); 269 IC::GetCodeCacheForObject(*receiver, *holder);
269 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 270 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
270 Code::Flags flags = 271 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC);
271 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL);
272 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 272 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
273 isolate_); 273 isolate_);
274 if (probe->IsCode()) return Handle<Code>::cast(probe); 274 if (probe->IsCode()) return Handle<Code>::cast(probe);
275 275
276 LoadStubCompiler compiler(isolate_); 276 LoadStubCompiler compiler(isolate_);
277 Handle<Code> code = 277 Handle<Code> code =
278 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); 278 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
279 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 279 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
280 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 280 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
281 JSObject::UpdateMapCodeCache(map_holder, name, code); 281 JSObject::UpdateMapCodeCache(map_holder, name, code);
282 return code; 282 return code;
283 } 283 }
284 284
285 285
286 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name, 286 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name,
287 Handle<JSObject> receiver, 287 Handle<JSObject> receiver,
288 Handle<JSObject> holder, 288 Handle<JSObject> holder,
289 PropertyIndex field) { 289 PropertyIndex field) {
290 InlineCacheHolderFlag cache_holder = 290 InlineCacheHolderFlag cache_holder =
291 IC::GetCodeCacheForObject(*receiver, *holder); 291 IC::GetCodeCacheForObject(*receiver, *holder);
292 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 292 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
293 Code::Flags flags = 293 Code::Flags flags = Code::ComputeMonomorphicFlags(
294 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::FIELD); 294 Code::KEYED_LOAD_IC, Code::kNoExtraICState, Code::FIELD);
295 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 295 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
296 isolate_); 296 isolate_);
297 if (probe->IsCode()) return Handle<Code>::cast(probe); 297 if (probe->IsCode()) return Handle<Code>::cast(probe);
298 298
299 KeyedLoadStubCompiler compiler(isolate_); 299 KeyedLoadStubCompiler compiler(isolate_);
300 Handle<Code> code = compiler.CompileLoadField(receiver, holder, name, field); 300 Handle<Code> code = compiler.CompileLoadField(receiver, holder, name, field);
301 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 301 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
302 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 302 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
303 JSObject::UpdateMapCodeCache(map_holder, name, code); 303 JSObject::UpdateMapCodeCache(map_holder, name, code);
304 return code; 304 return code;
305 } 305 }
306 306
307 307
308 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name, 308 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name,
309 Handle<JSObject> receiver, 309 Handle<JSObject> receiver,
310 Handle<JSObject> holder, 310 Handle<JSObject> holder,
311 Handle<JSFunction> value) { 311 Handle<JSFunction> value) {
312 InlineCacheHolderFlag cache_holder = 312 InlineCacheHolderFlag cache_holder =
313 IC::GetCodeCacheForObject(*receiver, *holder); 313 IC::GetCodeCacheForObject(*receiver, *holder);
314 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 314 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
315 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, 315 Code::Flags flags = Code::ComputeMonomorphicFlags(
316 Code::CONSTANT_FUNCTION); 316 Code::KEYED_LOAD_IC, Code::kNoExtraICState, Code::CONSTANT_FUNCTION);
317 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 317 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
318 isolate_); 318 isolate_);
319 if (probe->IsCode()) return Handle<Code>::cast(probe); 319 if (probe->IsCode()) return Handle<Code>::cast(probe);
320 320
321 KeyedLoadStubCompiler compiler(isolate_); 321 KeyedLoadStubCompiler compiler(isolate_);
322 Handle<Code> code = 322 Handle<Code> code =
323 compiler.CompileLoadConstant(receiver, holder, name, value); 323 compiler.CompileLoadConstant(receiver, holder, name, value);
324 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 324 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
325 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 325 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
326 JSObject::UpdateMapCodeCache(map_holder, name, code); 326 JSObject::UpdateMapCodeCache(map_holder, name, code);
327 return code; 327 return code;
328 } 328 }
329 329
330 330
331 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name, 331 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name,
332 Handle<JSObject> receiver, 332 Handle<JSObject> receiver,
333 Handle<JSObject> holder) { 333 Handle<JSObject> holder) {
334 InlineCacheHolderFlag cache_holder = 334 InlineCacheHolderFlag cache_holder =
335 IC::GetCodeCacheForObject(*receiver, *holder); 335 IC::GetCodeCacheForObject(*receiver, *holder);
336 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 336 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
337 Code::Flags flags = 337 Code::Flags flags = Code::ComputeMonomorphicFlags(
338 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::INTERCEPTOR); 338 Code::KEYED_LOAD_IC, Code::kNoExtraICState, Code::INTERCEPTOR);
339 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 339 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
340 isolate_); 340 isolate_);
341 if (probe->IsCode()) return Handle<Code>::cast(probe); 341 if (probe->IsCode()) return Handle<Code>::cast(probe);
342 342
343 KeyedLoadStubCompiler compiler(isolate_); 343 KeyedLoadStubCompiler compiler(isolate_);
344 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name); 344 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name);
345 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 345 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
346 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 346 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
347 JSObject::UpdateMapCodeCache(map_holder, name, code); 347 JSObject::UpdateMapCodeCache(map_holder, name, code);
348 return code; 348 return code;
349 } 349 }
350 350
351 351
352 Handle<Code> StubCache::ComputeKeyedLoadCallback( 352 Handle<Code> StubCache::ComputeKeyedLoadCallback(
353 Handle<String> name, 353 Handle<String> name,
354 Handle<JSObject> receiver, 354 Handle<JSObject> receiver,
355 Handle<JSObject> holder, 355 Handle<JSObject> holder,
356 Handle<AccessorInfo> callback) { 356 Handle<AccessorInfo> callback) {
357 InlineCacheHolderFlag cache_holder = 357 InlineCacheHolderFlag cache_holder =
358 IC::GetCodeCacheForObject(*receiver, *holder); 358 IC::GetCodeCacheForObject(*receiver, *holder);
359 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 359 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
360 Code::Flags flags = 360 Code::Flags flags = Code::ComputeMonomorphicFlags(
361 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); 361 Code::KEYED_LOAD_IC, Code::kNoExtraICState, Code::CALLBACKS);
362 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 362 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
363 isolate_); 363 isolate_);
364 if (probe->IsCode()) return Handle<Code>::cast(probe); 364 if (probe->IsCode()) return Handle<Code>::cast(probe);
365 365
366 KeyedLoadStubCompiler compiler(isolate_); 366 KeyedLoadStubCompiler compiler(isolate_);
367 Handle<Code> code = 367 Handle<Code> code =
368 compiler.CompileLoadCallback(receiver, holder, name, callback); 368 compiler.CompileLoadCallback(receiver, holder, name, callback);
369 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 369 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
370 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 370 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
371 JSObject::UpdateMapCodeCache(map_holder, name, code); 371 JSObject::UpdateMapCodeCache(map_holder, name, code);
372 return code; 372 return code;
373 } 373 }
374 374
375 375
376 Handle<Code> StubCache::ComputeStoreField(Handle<String> name, 376 Handle<Code> StubCache::ComputeStoreField(Handle<String> name,
377 Handle<JSObject> receiver, 377 Handle<JSObject> receiver,
378 int field_index, 378 int field_index,
379 Handle<Map> transition, 379 Handle<Map> transition,
380 StrictModeFlag strict_mode) { 380 StrictModeFlag strict_mode) {
381 Code::StubType type = 381 Code::StubType type =
382 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; 382 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION;
383 Code::Flags flags = Code::ComputeMonomorphicFlags( 383 Code::Flags flags = Code::ComputeMonomorphicFlags(
384 Code::STORE_IC, type, strict_mode); 384 Code::STORE_IC, strict_mode, type);
385 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 385 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
386 isolate_); 386 isolate_);
387 if (probe->IsCode()) return Handle<Code>::cast(probe); 387 if (probe->IsCode()) return Handle<Code>::cast(probe);
388 388
389 StoreStubCompiler compiler(isolate_, strict_mode); 389 StoreStubCompiler compiler(isolate_, strict_mode);
390 Handle<Code> code = 390 Handle<Code> code =
391 compiler.CompileStoreField(receiver, field_index, transition, name); 391 compiler.CompileStoreField(receiver, field_index, transition, name);
392 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 392 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
393 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 393 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
394 JSObject::UpdateMapCodeCache(receiver, name, code); 394 JSObject::UpdateMapCodeCache(receiver, name, code);
395 return code; 395 return code;
396 } 396 }
397 397
398 398
399 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { 399 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) {
400 Code::Flags flags = 400 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
401 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::NORMAL);
402 Handle<String> name = 401 Handle<String> name =
403 isolate()->factory()->KeyedLoadElementMonomorphic_symbol(); 402 isolate()->factory()->KeyedLoadElementMonomorphic_symbol();
404 403
405 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 404 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
406 if (probe->IsCode()) return Handle<Code>::cast(probe); 405 if (probe->IsCode()) return Handle<Code>::cast(probe);
407 406
408 KeyedLoadStubCompiler compiler(isolate()); 407 KeyedLoadStubCompiler compiler(isolate());
409 Handle<Code> code = compiler.CompileLoadElement(receiver_map); 408 Handle<Code> code = compiler.CompileLoadElement(receiver_map);
410 409
411 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0)); 410 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0));
412 Map::UpdateCodeCache(receiver_map, name, code); 411 Map::UpdateCodeCache(receiver_map, name, code);
413 return code; 412 return code;
414 } 413 }
415 414
416 415
417 Handle<Code> StubCache::ComputeKeyedStoreElement( 416 Handle<Code> StubCache::ComputeKeyedStoreElement(
418 Handle<Map> receiver_map, 417 Handle<Map> receiver_map,
419 KeyedStoreIC::StubKind stub_kind, 418 KeyedStoreIC::StubKind stub_kind,
420 StrictModeFlag strict_mode, 419 StrictModeFlag strict_mode,
421 KeyedAccessGrowMode grow_mode) { 420 KeyedAccessGrowMode grow_mode) {
422 Code::ExtraICState extra_state = 421 Code::ExtraICState extra_state =
423 Code::ComputeExtraICState(grow_mode, strict_mode); 422 Code::ComputeExtraICState(grow_mode, strict_mode);
424 Code::Flags flags = Code::ComputeMonomorphicFlags( 423 Code::Flags flags = Code::ComputeMonomorphicFlags(
425 Code::KEYED_STORE_IC, Code::NORMAL, extra_state); 424 Code::KEYED_STORE_IC, extra_state);
426 425
427 ASSERT(stub_kind == KeyedStoreIC::STORE_NO_TRANSITION || 426 ASSERT(stub_kind == KeyedStoreIC::STORE_NO_TRANSITION ||
428 stub_kind == KeyedStoreIC::STORE_AND_GROW_NO_TRANSITION); 427 stub_kind == KeyedStoreIC::STORE_AND_GROW_NO_TRANSITION);
429 428
430 Handle<String> name = stub_kind == KeyedStoreIC::STORE_NO_TRANSITION 429 Handle<String> name = stub_kind == KeyedStoreIC::STORE_NO_TRANSITION
431 ? isolate()->factory()->KeyedStoreElementMonomorphic_symbol() 430 ? isolate()->factory()->KeyedStoreElementMonomorphic_symbol()
432 : isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); 431 : isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol();
433 432
434 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 433 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
435 if (probe->IsCode()) return Handle<Code>::cast(probe); 434 if (probe->IsCode()) return Handle<Code>::cast(probe);
(...skipping 12 matching lines...) Expand all
448 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() 447 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict()
449 : isolate_->builtins()->Builtins::StoreIC_Normal(); 448 : isolate_->builtins()->Builtins::StoreIC_Normal();
450 } 449 }
451 450
452 451
453 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name, 452 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name,
454 Handle<GlobalObject> receiver, 453 Handle<GlobalObject> receiver,
455 Handle<JSGlobalPropertyCell> cell, 454 Handle<JSGlobalPropertyCell> cell,
456 StrictModeFlag strict_mode) { 455 StrictModeFlag strict_mode) {
457 Code::Flags flags = Code::ComputeMonomorphicFlags( 456 Code::Flags flags = Code::ComputeMonomorphicFlags(
458 Code::STORE_IC, Code::NORMAL, strict_mode); 457 Code::STORE_IC, strict_mode);
459 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 458 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
460 isolate_); 459 isolate_);
461 if (probe->IsCode()) return Handle<Code>::cast(probe); 460 if (probe->IsCode()) return Handle<Code>::cast(probe);
462 461
463 StoreStubCompiler compiler(isolate_, strict_mode); 462 StoreStubCompiler compiler(isolate_, strict_mode);
464 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); 463 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name);
465 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 464 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
466 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 465 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
467 JSObject::UpdateMapCodeCache(receiver, name, code); 466 JSObject::UpdateMapCodeCache(receiver, name, code);
468 return code; 467 return code;
469 } 468 }
470 469
471 470
472 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, 471 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name,
473 Handle<JSObject> receiver, 472 Handle<JSObject> receiver,
474 Handle<JSObject> holder, 473 Handle<JSObject> holder,
475 Handle<AccessorInfo> callback, 474 Handle<AccessorInfo> callback,
476 StrictModeFlag strict_mode) { 475 StrictModeFlag strict_mode) {
477 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); 476 ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
478 Code::Flags flags = Code::ComputeMonomorphicFlags( 477 Code::Flags flags = Code::ComputeMonomorphicFlags(
479 Code::STORE_IC, Code::CALLBACKS, strict_mode); 478 Code::STORE_IC, strict_mode, Code::CALLBACKS);
480 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 479 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
481 isolate_); 480 isolate_);
482 if (probe->IsCode()) return Handle<Code>::cast(probe); 481 if (probe->IsCode()) return Handle<Code>::cast(probe);
483 482
484 StoreStubCompiler compiler(isolate_, strict_mode); 483 StoreStubCompiler compiler(isolate_, strict_mode);
485 Handle<Code> code = 484 Handle<Code> code =
486 compiler.CompileStoreCallback(name, receiver, holder, callback); 485 compiler.CompileStoreCallback(name, receiver, holder, callback);
487 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 486 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
488 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 487 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
489 JSObject::UpdateMapCodeCache(receiver, name, code); 488 JSObject::UpdateMapCodeCache(receiver, name, code);
490 return code; 489 return code;
491 } 490 }
492 491
493 492
494 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<String> name, 493 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<String> name,
495 Handle<JSObject> receiver, 494 Handle<JSObject> receiver,
496 Handle<JSObject> holder, 495 Handle<JSObject> holder,
497 Handle<JSFunction> setter, 496 Handle<JSFunction> setter,
498 StrictModeFlag strict_mode) { 497 StrictModeFlag strict_mode) {
499 Code::Flags flags = Code::ComputeMonomorphicFlags( 498 Code::Flags flags = Code::ComputeMonomorphicFlags(
500 Code::STORE_IC, Code::CALLBACKS, strict_mode); 499 Code::STORE_IC, strict_mode, Code::CALLBACKS);
501 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 500 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
502 isolate_); 501 isolate_);
503 if (probe->IsCode()) return Handle<Code>::cast(probe); 502 if (probe->IsCode()) return Handle<Code>::cast(probe);
504 503
505 StoreStubCompiler compiler(isolate_, strict_mode); 504 StoreStubCompiler compiler(isolate_, strict_mode);
506 Handle<Code> code = 505 Handle<Code> code =
507 compiler.CompileStoreViaSetter(name, receiver, holder, setter); 506 compiler.CompileStoreViaSetter(name, receiver, holder, setter);
508 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 507 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
509 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 508 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
510 JSObject::UpdateMapCodeCache(receiver, name, code); 509 JSObject::UpdateMapCodeCache(receiver, name, code);
511 return code; 510 return code;
512 } 511 }
513 512
514 513
515 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name, 514 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name,
516 Handle<JSObject> receiver, 515 Handle<JSObject> receiver,
517 StrictModeFlag strict_mode) { 516 StrictModeFlag strict_mode) {
518 Code::Flags flags = Code::ComputeMonomorphicFlags( 517 Code::Flags flags = Code::ComputeMonomorphicFlags(
519 Code::STORE_IC, Code::INTERCEPTOR, strict_mode); 518 Code::STORE_IC, strict_mode, Code::INTERCEPTOR);
520 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 519 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
521 isolate_); 520 isolate_);
522 if (probe->IsCode()) return Handle<Code>::cast(probe); 521 if (probe->IsCode()) return Handle<Code>::cast(probe);
523 522
524 StoreStubCompiler compiler(isolate_, strict_mode); 523 StoreStubCompiler compiler(isolate_, strict_mode);
525 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); 524 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name);
526 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 525 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
527 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 526 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
528 JSObject::UpdateMapCodeCache(receiver, name, code); 527 JSObject::UpdateMapCodeCache(receiver, name, code);
529 return code; 528 return code;
530 } 529 }
531 530
532 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name, 531 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name,
533 Handle<JSObject> receiver, 532 Handle<JSObject> receiver,
534 int field_index, 533 int field_index,
535 Handle<Map> transition, 534 Handle<Map> transition,
536 StrictModeFlag strict_mode) { 535 StrictModeFlag strict_mode) {
537 Code::StubType type = 536 Code::StubType type =
538 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; 537 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION;
539 Code::Flags flags = Code::ComputeMonomorphicFlags( 538 Code::Flags flags = Code::ComputeMonomorphicFlags(
540 Code::KEYED_STORE_IC, type, strict_mode); 539 Code::KEYED_STORE_IC, strict_mode, type);
541 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 540 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
542 isolate_); 541 isolate_);
543 if (probe->IsCode()) return Handle<Code>::cast(probe); 542 if (probe->IsCode()) return Handle<Code>::cast(probe);
544 543
545 KeyedStoreStubCompiler compiler(isolate(), strict_mode, 544 KeyedStoreStubCompiler compiler(isolate(), strict_mode,
546 DO_NOT_ALLOW_JSARRAY_GROWTH); 545 DO_NOT_ALLOW_JSARRAY_GROWTH);
547 Handle<Code> code = 546 Handle<Code> code =
548 compiler.CompileStoreField(receiver, field_index, transition, name); 547 compiler.CompileStoreField(receiver, field_index, transition, name);
549 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); 548 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name));
550 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); 549 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code));
(...skipping 28 matching lines...) Expand all
579 } 578 }
580 579
581 if (check != RECEIVER_MAP_CHECK && 580 if (check != RECEIVER_MAP_CHECK &&
582 !function->IsBuiltin() && 581 !function->IsBuiltin() &&
583 function->shared()->is_classic_mode()) { 582 function->shared()->is_classic_mode()) {
584 // Calling non-strict non-builtins with a value as the receiver 583 // Calling non-strict non-builtins with a value as the receiver
585 // requires boxing. 584 // requires boxing.
586 return Handle<Code>::null(); 585 return Handle<Code>::null();
587 } 586 }
588 587
589 Code::Flags flags = 588 Code::Flags flags = Code::ComputeMonomorphicFlags(
590 Code::ComputeMonomorphicFlags(kind, Code::CONSTANT_FUNCTION, extra_state, 589 kind, extra_state, Code::CONSTANT_FUNCTION, argc, cache_holder);
591 cache_holder, argc);
592 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 590 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
593 isolate_); 591 isolate_);
594 if (probe->IsCode()) return Handle<Code>::cast(probe); 592 if (probe->IsCode()) return Handle<Code>::cast(probe);
595 593
596 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); 594 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder);
597 Handle<Code> code = 595 Handle<Code> code =
598 compiler.CompileCallConstant(object, holder, name, check, function); 596 compiler.CompileCallConstant(object, holder, name, check, function);
599 code->set_check_type(check); 597 code->set_check_type(check);
600 ASSERT_EQ(flags, code->flags()); 598 ASSERT_EQ(flags, code->flags());
601 PROFILE(isolate_, 599 PROFILE(isolate_,
(...skipping 16 matching lines...) Expand all
618 IC::GetCodeCacheForObject(*object, *holder); 616 IC::GetCodeCacheForObject(*object, *holder);
619 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*object, cache_holder)); 617 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*object, cache_holder));
620 618
621 // TODO(1233596): We cannot do receiver map check for non-JS objects 619 // TODO(1233596): We cannot do receiver map check for non-JS objects
622 // because they may be represented as immediates without a 620 // because they may be represented as immediates without a
623 // map. Instead, we check against the map in the holder. 621 // map. Instead, we check against the map in the holder.
624 if (object->IsNumber() || object->IsBoolean() || object->IsString()) { 622 if (object->IsNumber() || object->IsBoolean() || object->IsString()) {
625 object = holder; 623 object = holder;
626 } 624 }
627 625
628 Code::Flags flags = 626 Code::Flags flags = Code::ComputeMonomorphicFlags(
629 Code::ComputeMonomorphicFlags(kind, Code::FIELD, extra_state, 627 kind, extra_state, Code::FIELD, argc, cache_holder);
630 cache_holder, argc);
631 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 628 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
632 isolate_); 629 isolate_);
633 if (probe->IsCode()) return Handle<Code>::cast(probe); 630 if (probe->IsCode()) return Handle<Code>::cast(probe);
634 631
635 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); 632 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder);
636 Handle<Code> code = 633 Handle<Code> code =
637 compiler.CompileCallField(Handle<JSObject>::cast(object), 634 compiler.CompileCallField(Handle<JSObject>::cast(object),
638 holder, index, name); 635 holder, index, name);
639 ASSERT_EQ(flags, code->flags()); 636 ASSERT_EQ(flags, code->flags());
640 PROFILE(isolate_, 637 PROFILE(isolate_,
(...skipping 15 matching lines...) Expand all
656 IC::GetCodeCacheForObject(*object, *holder); 653 IC::GetCodeCacheForObject(*object, *holder);
657 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*object, cache_holder)); 654 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*object, cache_holder));
658 655
659 // TODO(1233596): We cannot do receiver map check for non-JS objects 656 // TODO(1233596): We cannot do receiver map check for non-JS objects
660 // because they may be represented as immediates without a 657 // because they may be represented as immediates without a
661 // map. Instead, we check against the map in the holder. 658 // map. Instead, we check against the map in the holder.
662 if (object->IsNumber() || object->IsBoolean() || object->IsString()) { 659 if (object->IsNumber() || object->IsBoolean() || object->IsString()) {
663 object = holder; 660 object = holder;
664 } 661 }
665 662
666 Code::Flags flags = 663 Code::Flags flags = Code::ComputeMonomorphicFlags(
667 Code::ComputeMonomorphicFlags(kind, Code::INTERCEPTOR, extra_state, 664 kind, extra_state, Code::INTERCEPTOR, argc, cache_holder);
668 cache_holder, argc);
669 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 665 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
670 isolate_); 666 isolate_);
671 if (probe->IsCode()) return Handle<Code>::cast(probe); 667 if (probe->IsCode()) return Handle<Code>::cast(probe);
672 668
673 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); 669 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder);
674 Handle<Code> code = 670 Handle<Code> code =
675 compiler.CompileCallInterceptor(Handle<JSObject>::cast(object), 671 compiler.CompileCallInterceptor(Handle<JSObject>::cast(object),
676 holder, name); 672 holder, name);
677 ASSERT_EQ(flags, code->flags()); 673 ASSERT_EQ(flags, code->flags());
678 PROFILE(isolate(), 674 PROFILE(isolate(),
679 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); 675 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
680 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); 676 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code));
681 JSObject::UpdateMapCodeCache(map_holder, name, code); 677 JSObject::UpdateMapCodeCache(map_holder, name, code);
682 return code; 678 return code;
683 } 679 }
684 680
685 681
686 Handle<Code> StubCache::ComputeCallGlobal(int argc, 682 Handle<Code> StubCache::ComputeCallGlobal(int argc,
687 Code::Kind kind, 683 Code::Kind kind,
688 Code::ExtraICState extra_state, 684 Code::ExtraICState extra_state,
689 Handle<String> name, 685 Handle<String> name,
690 Handle<JSObject> receiver, 686 Handle<JSObject> receiver,
691 Handle<GlobalObject> holder, 687 Handle<GlobalObject> holder,
692 Handle<JSGlobalPropertyCell> cell, 688 Handle<JSGlobalPropertyCell> cell,
693 Handle<JSFunction> function) { 689 Handle<JSFunction> function) {
694 InlineCacheHolderFlag cache_holder = 690 InlineCacheHolderFlag cache_holder =
695 IC::GetCodeCacheForObject(*receiver, *holder); 691 IC::GetCodeCacheForObject(*receiver, *holder);
696 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); 692 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
697 Code::Flags flags = 693 Code::Flags flags = Code::ComputeMonomorphicFlags(
698 Code::ComputeMonomorphicFlags(kind, Code::NORMAL, extra_state, 694 kind, extra_state, Code::NORMAL, argc, cache_holder);
699 cache_holder, argc);
700 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), 695 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
701 isolate_); 696 isolate_);
702 if (probe->IsCode()) return Handle<Code>::cast(probe); 697 if (probe->IsCode()) return Handle<Code>::cast(probe);
703 698
704 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); 699 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder);
705 Handle<Code> code = 700 Handle<Code> code =
706 compiler.CompileCallGlobal(receiver, holder, cell, function, name); 701 compiler.CompileCallGlobal(receiver, holder, cell, function, name);
707 ASSERT_EQ(flags, code->flags()); 702 ASSERT_EQ(flags, code->flags());
708 PROFILE(isolate(), 703 PROFILE(isolate(),
709 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); 704 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name));
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 return GetCode(Code::CALLBACKS, name); 1514 return GetCode(Code::CALLBACKS, name);
1520 } 1515 }
1521 1516
1522 1517
1523 #undef __ 1518 #undef __
1524 1519
1525 1520
1526 Handle<Code> LoadStubCompiler::GetCode(Code::StubType type, 1521 Handle<Code> LoadStubCompiler::GetCode(Code::StubType type,
1527 Handle<String> name, 1522 Handle<String> name,
1528 InlineCacheState state) { 1523 InlineCacheState state) {
1529 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, type); 1524 Code::Flags flags = Code::ComputeMonomorphicFlags(
1525 Code::LOAD_IC, Code::kNoExtraICState, type);
1530 Handle<Code> code = GetCodeWithFlags(flags, name); 1526 Handle<Code> code = GetCodeWithFlags(flags, name);
1531 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 1527 PROFILE(isolate(), CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
1532 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 1528 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
1533 return code; 1529 return code;
1534 } 1530 }
1535 1531
1536 1532
1537 Handle<Code> KeyedLoadStubCompiler::GetCode(Code::StubType type, 1533 Handle<Code> KeyedLoadStubCompiler::GetCode(Code::StubType type,
1538 Handle<String> name, 1534 Handle<String> name,
1539 InlineCacheState state) { 1535 InlineCacheState state) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); 1571 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
1576 PROFILE(isolate(), 1572 PROFILE(isolate(),
1577 CodeCreateEvent(Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG, *code, 0)); 1573 CodeCreateEvent(Logger::KEYED_LOAD_POLYMORPHIC_IC_TAG, *code, 0));
1578 return code; 1574 return code;
1579 } 1575 }
1580 1576
1581 1577
1582 1578
1583 Handle<Code> StoreStubCompiler::GetCode(Code::StubType type, 1579 Handle<Code> StoreStubCompiler::GetCode(Code::StubType type,
1584 Handle<String> name) { 1580 Handle<String> name) {
1585 Code::Flags flags = 1581 Code::Flags flags = Code::ComputeMonomorphicFlags(
1586 Code::ComputeMonomorphicFlags(Code::STORE_IC, type, strict_mode_); 1582 Code::STORE_IC, strict_mode_, type);
1587 Handle<Code> code = GetCodeWithFlags(flags, name); 1583 Handle<Code> code = GetCodeWithFlags(flags, name);
1588 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 1584 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
1589 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 1585 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
1590 return code; 1586 return code;
1591 } 1587 }
1592 1588
1593 1589
1594 Handle<Code> KeyedStoreStubCompiler::GetCode(Code::StubType type, 1590 Handle<Code> KeyedStoreStubCompiler::GetCode(Code::StubType type,
1595 Handle<String> name, 1591 Handle<String> name,
1596 InlineCacheState state) { 1592 InlineCacheState state) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 cell, 1706 cell,
1711 function, 1707 function,
1712 fname); 1708 fname);
1713 } 1709 }
1714 1710
1715 1711
1716 Handle<Code> CallStubCompiler::GetCode(Code::StubType type, 1712 Handle<Code> CallStubCompiler::GetCode(Code::StubType type,
1717 Handle<String> name) { 1713 Handle<String> name) {
1718 int argc = arguments_.immediate(); 1714 int argc = arguments_.immediate();
1719 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_, 1715 Code::Flags flags = Code::ComputeMonomorphicFlags(kind_,
1716 extra_state_,
1720 type, 1717 type,
1721 extra_state_, 1718 argc,
1722 cache_holder_, 1719 cache_holder_);
1723 argc);
1724 return GetCodeWithFlags(flags, name); 1720 return GetCodeWithFlags(flags, name);
1725 } 1721 }
1726 1722
1727 1723
1728 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) { 1724 Handle<Code> CallStubCompiler::GetCode(Handle<JSFunction> function) {
1729 Handle<String> function_name; 1725 Handle<String> function_name;
1730 if (function->shared()->name()->IsString()) { 1726 if (function->shared()->name()->IsString()) {
1731 function_name = Handle<String>(String::cast(function->shared()->name())); 1727 function_name = Handle<String>(String::cast(function->shared()->name()));
1732 } 1728 }
1733 return GetCode(Code::CONSTANT_FUNCTION, function_name); 1729 return GetCode(Code::CONSTANT_FUNCTION, function_name);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 Handle<FunctionTemplateInfo>( 1805 Handle<FunctionTemplateInfo>(
1810 FunctionTemplateInfo::cast(signature->receiver())); 1806 FunctionTemplateInfo::cast(signature->receiver()));
1811 } 1807 }
1812 } 1808 }
1813 1809
1814 is_simple_api_call_ = true; 1810 is_simple_api_call_ = true;
1815 } 1811 }
1816 1812
1817 1813
1818 } } // namespace v8::internal 1814 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/type-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698