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

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

Issue 8365003: Reset failure flag before retrying stub compilation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 primary->key = name; 106 primary->key = name;
107 primary->value = code; 107 primary->value = code;
108 return code; 108 return code;
109 } 109 }
110 110
111 111
112 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, 112 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name,
113 Handle<JSObject> object, 113 Handle<JSObject> object,
114 Handle<JSObject> last) { 114 Handle<JSObject> last) {
115 CALL_HEAP_FUNCTION(isolate(), 115 CALL_HEAP_FUNCTION(isolate(),
116 CompileLoadNonexistent(*name, *object, *last), 116 (set_failure(NULL),
117 CompileLoadNonexistent(*name, *object, *last)),
117 Code); 118 Code);
118 } 119 }
119 120
120 121
121 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<String> name, 122 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<String> name,
122 Handle<JSObject> receiver) { 123 Handle<JSObject> receiver) {
123 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties()); 124 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties());
124 // If no global objects are present in the prototype chain, the load 125 // If no global objects are present in the prototype chain, the load
125 // nonexistent IC stub can be shared for all names for a given map 126 // nonexistent IC stub can be shared for all names for a given map
126 // and we use the empty string for the map cache in that case. If 127 // and we use the empty string for the map cache in that case. If
(...skipping 22 matching lines...) Expand all
149 JSObject::UpdateMapCodeCache(isolate_, receiver, cache_name, code); 150 JSObject::UpdateMapCodeCache(isolate_, receiver, cache_name, code);
150 return code; 151 return code;
151 } 152 }
152 153
153 154
154 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, 155 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object,
155 Handle<JSObject> holder, 156 Handle<JSObject> holder,
156 int index, 157 int index,
157 Handle<String> name) { 158 Handle<String> name) {
158 CALL_HEAP_FUNCTION(isolate(), 159 CALL_HEAP_FUNCTION(isolate(),
159 CompileLoadField(*object, *holder, index, *name), 160 (set_failure(NULL),
161 CompileLoadField(*object, *holder, index, *name)),
160 Code); 162 Code);
161 } 163 }
162 164
163 165
164 Handle<Code> StubCache::ComputeLoadField(Handle<String> name, 166 Handle<Code> StubCache::ComputeLoadField(Handle<String> name,
165 Handle<JSObject> receiver, 167 Handle<JSObject> receiver,
166 Handle<JSObject> holder, 168 Handle<JSObject> holder,
167 int field_index) { 169 int field_index) {
168 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 170 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
169 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); 171 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD);
170 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 172 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
171 if (probe->IsCode()) return Handle<Code>::cast(probe); 173 if (probe->IsCode()) return Handle<Code>::cast(probe);
172 174
173 LoadStubCompiler compiler(isolate_); 175 LoadStubCompiler compiler(isolate_);
174 Handle<Code> code = 176 Handle<Code> code =
175 compiler.CompileLoadField(receiver, holder, field_index, name); 177 compiler.CompileLoadField(receiver, holder, field_index, name);
176 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 178 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
177 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 179 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
178 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 180 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
179 return code; 181 return code;
180 } 182 }
181 183
182 184
183 Handle<Code> LoadStubCompiler::CompileLoadCallback( 185 Handle<Code> LoadStubCompiler::CompileLoadCallback(
184 Handle<String> name, 186 Handle<String> name,
185 Handle<JSObject> object, 187 Handle<JSObject> object,
186 Handle<JSObject> holder, 188 Handle<JSObject> holder,
187 Handle<AccessorInfo> callback) { 189 Handle<AccessorInfo> callback) {
188 CALL_HEAP_FUNCTION(isolate(), 190 CALL_HEAP_FUNCTION(isolate(),
189 CompileLoadCallback(*name, *object, *holder, *callback), 191 (set_failure(NULL),
192 CompileLoadCallback(*name, *object, *holder, *callback)),
190 Code); 193 Code);
191 } 194 }
192 195
193 196
194 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, 197 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name,
195 Handle<JSObject> receiver, 198 Handle<JSObject> receiver,
196 Handle<JSObject> holder, 199 Handle<JSObject> holder,
197 Handle<AccessorInfo> callback) { 200 Handle<AccessorInfo> callback) {
198 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); 201 ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
199 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 202 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
200 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); 203 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS);
201 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 204 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
202 if (probe->IsCode()) return Handle<Code>::cast(probe); 205 if (probe->IsCode()) return Handle<Code>::cast(probe);
203 206
204 LoadStubCompiler compiler(isolate_); 207 LoadStubCompiler compiler(isolate_);
205 Handle<Code> code = 208 Handle<Code> code =
206 compiler.CompileLoadCallback(name, receiver, holder, callback); 209 compiler.CompileLoadCallback(name, receiver, holder, callback);
207 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 210 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
208 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 211 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
209 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 212 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
210 return code; 213 return code;
211 } 214 }
212 215
213 216
214 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, 217 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object,
215 Handle<JSObject> holder, 218 Handle<JSObject> holder,
216 Handle<Object> value, 219 Handle<Object> value,
217 Handle<String> name) { 220 Handle<String> name) {
218 CALL_HEAP_FUNCTION(isolate(), 221 CALL_HEAP_FUNCTION(isolate(),
219 CompileLoadConstant(*object, *holder, *value, *name), 222 (set_failure(NULL),
223 CompileLoadConstant(*object, *holder, *value, *name)),
220 Code); 224 Code);
221 } 225 }
222 226
223 227
224 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, 228 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name,
225 Handle<JSObject> receiver, 229 Handle<JSObject> receiver,
226 Handle<JSObject> holder, 230 Handle<JSObject> holder,
227 Handle<Object> value) { 231 Handle<Object> value) {
228 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 232 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
229 Code::Flags flags = 233 Code::Flags flags =
230 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); 234 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION);
231 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 235 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
232 if (probe->IsCode()) return Handle<Code>::cast(probe); 236 if (probe->IsCode()) return Handle<Code>::cast(probe);
233 237
234 LoadStubCompiler compiler(isolate_); 238 LoadStubCompiler compiler(isolate_);
235 Handle<Code> code = 239 Handle<Code> code =
236 compiler.CompileLoadConstant(receiver, holder, value, name); 240 compiler.CompileLoadConstant(receiver, holder, value, name);
237 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 241 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
238 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 242 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
239 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 243 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
240 return code; 244 return code;
241 } 245 }
242 246
243 247
244 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> object, 248 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> object,
245 Handle<JSObject> holder, 249 Handle<JSObject> holder,
246 Handle<String> name) { 250 Handle<String> name) {
247 CALL_HEAP_FUNCTION(isolate(), 251 CALL_HEAP_FUNCTION(isolate(),
248 CompileLoadInterceptor(*object, *holder, *name), 252 (set_failure(NULL),
253 CompileLoadInterceptor(*object, *holder, *name)),
249 Code); 254 Code);
250 } 255 }
251 256
252 257
253 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name, 258 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name,
254 Handle<JSObject> receiver, 259 Handle<JSObject> receiver,
255 Handle<JSObject> holder) { 260 Handle<JSObject> holder) {
256 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 261 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
257 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); 262 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR);
258 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 263 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
(...skipping 13 matching lines...) Expand all
272 return isolate_->builtins()->LoadIC_Normal(); 277 return isolate_->builtins()->LoadIC_Normal();
273 } 278 }
274 279
275 Handle<Code> LoadStubCompiler::CompileLoadGlobal( 280 Handle<Code> LoadStubCompiler::CompileLoadGlobal(
276 Handle<JSObject> object, 281 Handle<JSObject> object,
277 Handle<GlobalObject> holder, 282 Handle<GlobalObject> holder,
278 Handle<JSGlobalPropertyCell> cell, 283 Handle<JSGlobalPropertyCell> cell,
279 Handle<String> name, 284 Handle<String> name,
280 bool is_dont_delete) { 285 bool is_dont_delete) {
281 CALL_HEAP_FUNCTION(isolate(), 286 CALL_HEAP_FUNCTION(isolate(),
282 CompileLoadGlobal(*object, 287 (set_failure(NULL),
283 *holder, 288 CompileLoadGlobal(
284 *cell, 289 *object, *holder, *cell, *name, is_dont_delete)),
285 *name,
286 is_dont_delete),
287 Code); 290 Code);
288 } 291 }
289 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name, 292 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name,
290 Handle<JSObject> receiver, 293 Handle<JSObject> receiver,
291 Handle<GlobalObject> holder, 294 Handle<GlobalObject> holder,
292 Handle<JSGlobalPropertyCell> cell, 295 Handle<JSGlobalPropertyCell> cell,
293 bool is_dont_delete) { 296 bool is_dont_delete) {
294 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 297 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
295 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); 298 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL);
296 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 299 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
297 if (probe->IsCode()) return Handle<Code>::cast(probe); 300 if (probe->IsCode()) return Handle<Code>::cast(probe);
298 301
299 LoadStubCompiler compiler(isolate_); 302 LoadStubCompiler compiler(isolate_);
300 Handle<Code> code = 303 Handle<Code> code =
301 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); 304 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
302 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 305 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
303 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 306 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
304 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 307 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
305 return code; 308 return code;
306 } 309 }
307 310
308 311
309 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name, 312 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name,
310 Handle<JSObject> object, 313 Handle<JSObject> object,
311 Handle<JSObject> holder, 314 Handle<JSObject> holder,
312 int index) { 315 int index) {
313 CALL_HEAP_FUNCTION(isolate(), 316 CALL_HEAP_FUNCTION(isolate(),
314 CompileLoadField(*name, *object, *holder, index), 317 (set_failure(NULL),
318 CompileLoadField(*name, *object, *holder, index)),
315 Code); 319 Code);
316 } 320 }
317 321
318 322
319 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name, 323 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name,
320 Handle<JSObject> receiver, 324 Handle<JSObject> receiver,
321 Handle<JSObject> holder, 325 Handle<JSObject> holder,
322 int field_index) { 326 int field_index) {
323 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 327 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
324 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); 328 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD);
325 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 329 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
326 if (probe->IsCode()) return Handle<Code>::cast(probe); 330 if (probe->IsCode()) return Handle<Code>::cast(probe);
327 331
328 KeyedLoadStubCompiler compiler(isolate_); 332 KeyedLoadStubCompiler compiler(isolate_);
329 Handle<Code> code = 333 Handle<Code> code =
330 compiler.CompileLoadField(name, receiver, holder, field_index); 334 compiler.CompileLoadField(name, receiver, holder, field_index);
331 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 335 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
332 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 336 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
333 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 337 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
334 return code; 338 return code;
335 } 339 }
336 340
337 341
338 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(Handle<String> name, 342 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(Handle<String> name,
339 Handle<JSObject> object, 343 Handle<JSObject> object,
340 Handle<JSObject> holder, 344 Handle<JSObject> holder,
341 Handle<Object> value) { 345 Handle<Object> value) {
342 CALL_HEAP_FUNCTION(isolate(), 346 CALL_HEAP_FUNCTION(isolate(),
343 CompileLoadConstant(*name, *object, *holder, *value), 347 (set_failure(NULL),
348 CompileLoadConstant(*name, *object, *holder, *value)),
344 Code); 349 Code);
345 } 350 }
346 351
347 352
348 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name, 353 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name,
349 Handle<JSObject> receiver, 354 Handle<JSObject> receiver,
350 Handle<JSObject> holder, 355 Handle<JSObject> holder,
351 Handle<Object> value) { 356 Handle<Object> value) {
352 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 357 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
353 Code::Flags flags = 358 Code::Flags flags =
354 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); 359 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION);
355 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 360 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
356 if (probe->IsCode()) return Handle<Code>::cast(probe); 361 if (probe->IsCode()) return Handle<Code>::cast(probe);
357 362
358 KeyedLoadStubCompiler compiler(isolate_); 363 KeyedLoadStubCompiler compiler(isolate_);
359 Handle<Code> code = 364 Handle<Code> code =
360 compiler.CompileLoadConstant(name, receiver, holder, value); 365 compiler.CompileLoadConstant(name, receiver, holder, value);
361 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 366 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
362 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 367 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
363 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 368 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
364 return code; 369 return code;
365 } 370 }
366 371
367 372
368 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor( 373 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor(
369 Handle<JSObject> object, 374 Handle<JSObject> object,
370 Handle<JSObject> holder, 375 Handle<JSObject> holder,
371 Handle<String> name) { 376 Handle<String> name) {
372 CALL_HEAP_FUNCTION(isolate(), 377 CALL_HEAP_FUNCTION(isolate(),
373 CompileLoadInterceptor(*object, *holder, *name), 378 (set_failure(NULL),
379 CompileLoadInterceptor(*object, *holder, *name)),
374 Code); 380 Code);
375 } 381 }
376 382
377 383
378 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name, 384 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name,
379 Handle<JSObject> receiver, 385 Handle<JSObject> receiver,
380 Handle<JSObject> holder) { 386 Handle<JSObject> holder) {
381 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 387 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
382 Code::Flags flags = 388 Code::Flags flags =
383 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); 389 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR);
384 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 390 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
385 if (probe->IsCode()) return Handle<Code>::cast(probe); 391 if (probe->IsCode()) return Handle<Code>::cast(probe);
386 392
387 KeyedLoadStubCompiler compiler(isolate_); 393 KeyedLoadStubCompiler compiler(isolate_);
388 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name); 394 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name);
389 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 395 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
390 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 396 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
391 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 397 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
392 return code; 398 return code;
393 } 399 }
394 400
395 401
396 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback( 402 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback(
397 Handle<String> name, 403 Handle<String> name,
398 Handle<JSObject> object, 404 Handle<JSObject> object,
399 Handle<JSObject> holder, 405 Handle<JSObject> holder,
400 Handle<AccessorInfo> callback) { 406 Handle<AccessorInfo> callback) {
401 CALL_HEAP_FUNCTION(isolate(), 407 CALL_HEAP_FUNCTION(isolate(),
402 CompileLoadCallback(*name, *object, *holder, *callback), 408 (set_failure(NULL),
409 CompileLoadCallback(*name, *object, *holder, *callback)),
403 Code); 410 Code);
404 } 411 }
405 412
406 413
407 Handle<Code> StubCache::ComputeKeyedLoadCallback( 414 Handle<Code> StubCache::ComputeKeyedLoadCallback(
408 Handle<String> name, 415 Handle<String> name,
409 Handle<JSObject> receiver, 416 Handle<JSObject> receiver,
410 Handle<JSObject> holder, 417 Handle<JSObject> holder,
411 Handle<AccessorInfo> callback) { 418 Handle<AccessorInfo> callback) {
412 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 419 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
413 Code::Flags flags = 420 Code::Flags flags =
414 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 421 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
415 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 422 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
416 if (probe->IsCode()) return Handle<Code>::cast(probe); 423 if (probe->IsCode()) return Handle<Code>::cast(probe);
417 424
418 KeyedLoadStubCompiler compiler(isolate_); 425 KeyedLoadStubCompiler compiler(isolate_);
419 Handle<Code> code = 426 Handle<Code> code =
420 compiler.CompileLoadCallback(name, receiver, holder, callback); 427 compiler.CompileLoadCallback(name, receiver, holder, callback);
421 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 428 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
422 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 429 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
423 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 430 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
424 return code; 431 return code;
425 } 432 }
426 433
427 434
428 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength( 435 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength(
429 Handle<String> name) { 436 Handle<String> name) {
430 CALL_HEAP_FUNCTION(isolate(), 437 CALL_HEAP_FUNCTION(isolate(),
431 CompileLoadArrayLength(*name), 438 (set_failure(NULL),
439 CompileLoadArrayLength(*name)),
432 Code); 440 Code);
433 } 441 }
434 442
435 Handle<Code> StubCache::ComputeKeyedLoadArrayLength(Handle<String> name, 443 Handle<Code> StubCache::ComputeKeyedLoadArrayLength(Handle<String> name,
436 Handle<JSArray> receiver) { 444 Handle<JSArray> receiver) {
437 Code::Flags flags = 445 Code::Flags flags =
438 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 446 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
439 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 447 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
440 if (probe->IsCode()) return Handle<Code>::cast(probe); 448 if (probe->IsCode()) return Handle<Code>::cast(probe);
441 449
442 KeyedLoadStubCompiler compiler(isolate_); 450 KeyedLoadStubCompiler compiler(isolate_);
443 Handle<Code> code = compiler.CompileLoadArrayLength(name); 451 Handle<Code> code = compiler.CompileLoadArrayLength(name);
444 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 452 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
445 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 453 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
446 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 454 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
447 return code; 455 return code;
448 } 456 }
449 457
450 458
451 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength( 459 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength(
452 Handle<String> name) { 460 Handle<String> name) {
453 CALL_HEAP_FUNCTION(isolate(), 461 CALL_HEAP_FUNCTION(isolate(),
454 CompileLoadStringLength(*name), 462 (set_failure(NULL),
463 CompileLoadStringLength(*name)),
455 Code); 464 Code);
456 } 465 }
457 466
458 Handle<Code> StubCache::ComputeKeyedLoadStringLength(Handle<String> name, 467 Handle<Code> StubCache::ComputeKeyedLoadStringLength(Handle<String> name,
459 Handle<String> receiver) { 468 Handle<String> receiver) {
460 Code::Flags flags = 469 Code::Flags flags =
461 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 470 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
462 Handle<Map> map(receiver->map()); 471 Handle<Map> map(receiver->map());
463 Handle<Object> probe(map->FindInCodeCache(*name, flags)); 472 Handle<Object> probe(map->FindInCodeCache(*name, flags));
464 if (probe->IsCode()) return Handle<Code>::cast(probe); 473 if (probe->IsCode()) return Handle<Code>::cast(probe);
465 474
466 KeyedLoadStubCompiler compiler(isolate_); 475 KeyedLoadStubCompiler compiler(isolate_);
467 Handle<Code> code = compiler.CompileLoadStringLength(name); 476 Handle<Code> code = compiler.CompileLoadStringLength(name);
468 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 477 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
469 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 478 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
470 Map::UpdateCodeCache(map, name, code); 479 Map::UpdateCodeCache(map, name, code);
471 return code; 480 return code;
472 } 481 }
473 482
474 483
475 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype( 484 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype(
476 Handle<String> name) { 485 Handle<String> name) {
477 CALL_HEAP_FUNCTION(isolate(), 486 CALL_HEAP_FUNCTION(isolate(),
478 CompileLoadFunctionPrototype(*name), 487 (set_failure(NULL),
488 CompileLoadFunctionPrototype(*name)),
479 Code); 489 Code);
480 } 490 }
481 491
482 492
483 Handle<Code> StubCache::ComputeKeyedLoadFunctionPrototype( 493 Handle<Code> StubCache::ComputeKeyedLoadFunctionPrototype(
484 Handle<String> name, 494 Handle<String> name,
485 Handle<JSFunction> receiver) { 495 Handle<JSFunction> receiver) {
486 Code::Flags flags = 496 Code::Flags flags =
487 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 497 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
488 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 498 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
489 if (probe->IsCode()) return Handle<Code>::cast(probe); 499 if (probe->IsCode()) return Handle<Code>::cast(probe);
490 500
491 KeyedLoadStubCompiler compiler(isolate_); 501 KeyedLoadStubCompiler compiler(isolate_);
492 Handle<Code> code = compiler.CompileLoadFunctionPrototype(name); 502 Handle<Code> code = compiler.CompileLoadFunctionPrototype(name);
493 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 503 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
494 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 504 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
495 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 505 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
496 return code; 506 return code;
497 } 507 }
498 508
499 509
500 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object, 510 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object,
501 int index, 511 int index,
502 Handle<Map> transition, 512 Handle<Map> transition,
503 Handle<String> name) { 513 Handle<String> name) {
504 CALL_HEAP_FUNCTION(isolate(), 514 CALL_HEAP_FUNCTION(isolate(),
505 CompileStoreField(*object, 515 (set_failure(NULL),
506 index, 516 CompileStoreField(
507 (transition.is_null() 517 *object,
508 ? NULL 518 index,
509 : *transition), 519 (transition.is_null() ? NULL : *transition),
510 *name), 520 *name)),
511 Code); 521 Code);
512 } 522 }
513 523
514 524
515 Handle<Code> StubCache::ComputeStoreField(Handle<String> name, 525 Handle<Code> StubCache::ComputeStoreField(Handle<String> name,
516 Handle<JSObject> receiver, 526 Handle<JSObject> receiver,
517 int field_index, 527 int field_index,
518 Handle<Map> transition, 528 Handle<Map> transition,
519 StrictModeFlag strict_mode) { 529 StrictModeFlag strict_mode) {
520 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION; 530 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() 614 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict()
605 : isolate_->builtins()->Builtins::StoreIC_Normal(); 615 : isolate_->builtins()->Builtins::StoreIC_Normal();
606 } 616 }
607 617
608 618
609 Handle<Code> StoreStubCompiler::CompileStoreGlobal( 619 Handle<Code> StoreStubCompiler::CompileStoreGlobal(
610 Handle<GlobalObject> object, 620 Handle<GlobalObject> object,
611 Handle<JSGlobalPropertyCell> holder, 621 Handle<JSGlobalPropertyCell> holder,
612 Handle<String> name) { 622 Handle<String> name) {
613 CALL_HEAP_FUNCTION(isolate(), 623 CALL_HEAP_FUNCTION(isolate(),
614 CompileStoreGlobal(*object, *holder, *name), 624 (set_failure(NULL),
625 CompileStoreGlobal(*object, *holder, *name)),
615 Code); 626 Code);
616 } 627 }
617 628
618 629
619 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name, 630 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name,
620 Handle<GlobalObject> receiver, 631 Handle<GlobalObject> receiver,
621 Handle<JSGlobalPropertyCell> cell, 632 Handle<JSGlobalPropertyCell> cell,
622 StrictModeFlag strict_mode) { 633 StrictModeFlag strict_mode) {
623 Code::Flags flags = Code::ComputeMonomorphicFlags( 634 Code::Flags flags = Code::ComputeMonomorphicFlags(
624 Code::STORE_IC, NORMAL, strict_mode); 635 Code::STORE_IC, NORMAL, strict_mode);
625 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 636 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
626 if (probe->IsCode()) return Handle<Code>::cast(probe); 637 if (probe->IsCode()) return Handle<Code>::cast(probe);
627 638
628 StoreStubCompiler compiler(isolate_, strict_mode); 639 StoreStubCompiler compiler(isolate_, strict_mode);
629 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); 640 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name);
630 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 641 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
631 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 642 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
632 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 643 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
633 return code; 644 return code;
634 } 645 }
635 646
636 647
637 Handle<Code> StoreStubCompiler::CompileStoreCallback( 648 Handle<Code> StoreStubCompiler::CompileStoreCallback(
638 Handle<JSObject> object, 649 Handle<JSObject> object,
639 Handle<AccessorInfo> callback, 650 Handle<AccessorInfo> callback,
640 Handle<String> name) { 651 Handle<String> name) {
641 CALL_HEAP_FUNCTION(isolate(), 652 CALL_HEAP_FUNCTION(isolate(),
642 CompileStoreCallback(*object, *callback, *name), 653 (set_failure(NULL),
654 CompileStoreCallback(*object, *callback, *name)),
643 Code); 655 Code);
644 } 656 }
645 657
646 658
647 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, 659 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name,
648 Handle<JSObject> receiver, 660 Handle<JSObject> receiver,
649 Handle<AccessorInfo> callback, 661 Handle<AccessorInfo> callback,
650 StrictModeFlag strict_mode) { 662 StrictModeFlag strict_mode) {
651 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); 663 ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
652 Code::Flags flags = Code::ComputeMonomorphicFlags( 664 Code::Flags flags = Code::ComputeMonomorphicFlags(
653 Code::STORE_IC, CALLBACKS, strict_mode); 665 Code::STORE_IC, CALLBACKS, strict_mode);
654 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 666 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
655 if (probe->IsCode()) return Handle<Code>::cast(probe); 667 if (probe->IsCode()) return Handle<Code>::cast(probe);
656 668
657 StoreStubCompiler compiler(isolate_, strict_mode); 669 StoreStubCompiler compiler(isolate_, strict_mode);
658 Handle<Code> code = compiler.CompileStoreCallback(receiver, callback, name); 670 Handle<Code> code = compiler.CompileStoreCallback(receiver, callback, name);
659 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 671 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
660 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 672 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
661 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 673 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
662 return code; 674 return code;
663 } 675 }
664 676
665 677
666 Handle<Code> StoreStubCompiler::CompileStoreInterceptor(Handle<JSObject> object, 678 Handle<Code> StoreStubCompiler::CompileStoreInterceptor(Handle<JSObject> object,
667 Handle<String> name) { 679 Handle<String> name) {
668 CALL_HEAP_FUNCTION(isolate(), 680 CALL_HEAP_FUNCTION(isolate(),
669 CompileStoreInterceptor(*object, *name), 681 (set_failure(NULL),
682 CompileStoreInterceptor(*object, *name)),
670 Code); 683 Code);
671 } 684 }
672 685
673 686
674 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name, 687 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name,
675 Handle<JSObject> receiver, 688 Handle<JSObject> receiver,
676 StrictModeFlag strict_mode) { 689 StrictModeFlag strict_mode) {
677 Code::Flags flags = Code::ComputeMonomorphicFlags( 690 Code::Flags flags = Code::ComputeMonomorphicFlags(
678 Code::STORE_IC, INTERCEPTOR, strict_mode); 691 Code::STORE_IC, INTERCEPTOR, strict_mode);
679 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); 692 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
680 if (probe->IsCode()) return Handle<Code>::cast(probe); 693 if (probe->IsCode()) return Handle<Code>::cast(probe);
681 694
682 StoreStubCompiler compiler(isolate_, strict_mode); 695 StoreStubCompiler compiler(isolate_, strict_mode);
683 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); 696 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name);
684 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); 697 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
685 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); 698 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
686 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 699 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
687 return code; 700 return code;
688 } 701 }
689 702
690 Handle<Code> KeyedStoreStubCompiler::CompileStoreField(Handle<JSObject> object, 703 Handle<Code> KeyedStoreStubCompiler::CompileStoreField(Handle<JSObject> object,
691 int index, 704 int index,
692 Handle<Map> transition, 705 Handle<Map> transition,
693 Handle<String> name) { 706 Handle<String> name) {
694 CALL_HEAP_FUNCTION(isolate(), 707 CALL_HEAP_FUNCTION(isolate(),
695 CompileStoreField(*object, index, 708 (set_failure(NULL),
696 (transition.is_null() 709 CompileStoreField(
697 ? NULL 710 *object,
698 : *transition), 711 index,
699 *name), 712 (transition.is_null() ? NULL : *transition),
713 *name)),
700 Code); 714 Code);
701 } 715 }
702 716
703 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name, 717 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name,
704 Handle<JSObject> receiver, 718 Handle<JSObject> receiver,
705 int field_index, 719 int field_index,
706 Handle<Map> transition, 720 Handle<Map> transition,
707 StrictModeFlag strict_mode) { 721 StrictModeFlag strict_mode) {
708 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION; 722 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION;
709 Code::Flags flags = Code::ComputeMonomorphicFlags( 723 Code::Flags flags = Code::ComputeMonomorphicFlags(
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 expected_receiver_type_ = 1949 expected_receiver_type_ =
1936 FunctionTemplateInfo::cast(signature->receiver()); 1950 FunctionTemplateInfo::cast(signature->receiver());
1937 } 1951 }
1938 } 1952 }
1939 1953
1940 is_simple_api_call_ = true; 1954 is_simple_api_call_ = true;
1941 } 1955 }
1942 1956
1943 1957
1944 } } // namespace v8::internal 1958 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698