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

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

Issue 8352003: Handlify upper layers of KeyedLoadIC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments, rebase. 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 | « src/stub-cache.h ('k') | 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 LoadStubCompiler compiler(isolate_); 299 LoadStubCompiler compiler(isolate_);
300 Handle<Code> code = 300 Handle<Code> code =
301 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); 301 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
302 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 302 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
303 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 303 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
304 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); 304 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
305 return code; 305 return code;
306 } 306 }
307 307
308 308
309 MaybeObject* StubCache::ComputeKeyedLoadField(String* name, 309 Handle<Code> KeyedLoadStubCompiler::CompileLoadField(Handle<String> name,
310 JSObject* receiver, 310 Handle<JSObject> object,
311 JSObject* holder, 311 Handle<JSObject> holder,
312 int index) {
313 CALL_HEAP_FUNCTION(isolate(),
314 CompileLoadField(*name, *object, *holder, index),
315 Code);
316 }
317
318
319 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name,
320 Handle<JSObject> receiver,
321 Handle<JSObject> holder,
312 int field_index) { 322 int field_index) {
313 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); 323 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
314 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); 324 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD);
315 Object* code = receiver->map()->FindInCodeCache(name, flags); 325 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
316 if (code->IsUndefined()) { 326 if (probe->IsCode()) return Handle<Code>::cast(probe);
317 HandleScope scope(isolate_); 327
318 KeyedLoadStubCompiler compiler(isolate_); 328 KeyedLoadStubCompiler compiler(isolate_);
319 { MaybeObject* maybe_code = 329 Handle<Code> code =
320 compiler.CompileLoadField(name, receiver, holder, field_index); 330 compiler.CompileLoadField(name, receiver, holder, field_index);
321 if (!maybe_code->ToObject(&code)) return maybe_code; 331 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
322 } 332 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
323 PROFILE(isolate_, 333 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
324 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
325 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
326 Object* result;
327 { MaybeObject* maybe_result =
328 receiver->UpdateMapCodeCache(name, Code::cast(code));
329 if (!maybe_result->ToObject(&result)) return maybe_result;
330 }
331 }
332 return code; 334 return code;
333 } 335 }
334 336
335 337
336 MaybeObject* StubCache::ComputeKeyedLoadConstant(String* name, 338 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(Handle<String> name,
337 JSObject* receiver, 339 Handle<JSObject> object,
338 JSObject* holder, 340 Handle<JSObject> holder,
339 Object* value) { 341 Handle<Object> value) {
340 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); 342 CALL_HEAP_FUNCTION(isolate(),
343 CompileLoadConstant(*name, *object, *holder, *value),
344 Code);
345 }
346
347
348 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name,
349 Handle<JSObject> receiver,
350 Handle<JSObject> holder,
351 Handle<Object> value) {
352 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
341 Code::Flags flags = 353 Code::Flags flags =
342 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); 354 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION);
343 Object* code = receiver->map()->FindInCodeCache(name, flags); 355 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
344 if (code->IsUndefined()) { 356 if (probe->IsCode()) return Handle<Code>::cast(probe);
345 HandleScope scope(isolate_); 357
346 KeyedLoadStubCompiler compiler(isolate_); 358 KeyedLoadStubCompiler compiler(isolate_);
347 { MaybeObject* maybe_code = 359 Handle<Code> code =
348 compiler.CompileLoadConstant(name, receiver, holder, value); 360 compiler.CompileLoadConstant(name, receiver, holder, value);
349 if (!maybe_code->ToObject(&code)) return maybe_code; 361 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
350 } 362 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
351 PROFILE(isolate_, 363 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
352 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
353 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
354 Object* result;
355 { MaybeObject* maybe_result =
356 receiver->UpdateMapCodeCache(name, Code::cast(code));
357 if (!maybe_result->ToObject(&result)) return maybe_result;
358 }
359 }
360 return code; 364 return code;
361 } 365 }
362 366
363 367
364 MaybeObject* StubCache::ComputeKeyedLoadInterceptor(String* name, 368 Handle<Code> KeyedLoadStubCompiler::CompileLoadInterceptor(
365 JSObject* receiver, 369 Handle<JSObject> object,
366 JSObject* holder) { 370 Handle<JSObject> holder,
367 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); 371 Handle<String> name) {
372 CALL_HEAP_FUNCTION(isolate(),
373 CompileLoadInterceptor(*object, *holder, *name),
374 Code);
375 }
376
377
378 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name,
379 Handle<JSObject> receiver,
380 Handle<JSObject> holder) {
381 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
368 Code::Flags flags = 382 Code::Flags flags =
369 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); 383 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR);
370 Object* code = receiver->map()->FindInCodeCache(name, flags); 384 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
371 if (code->IsUndefined()) { 385 if (probe->IsCode()) return Handle<Code>::cast(probe);
372 HandleScope scope(isolate_); 386
373 KeyedLoadStubCompiler compiler(isolate_); 387 KeyedLoadStubCompiler compiler(isolate_);
374 { MaybeObject* maybe_code = 388 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name);
375 compiler.CompileLoadInterceptor(receiver, holder, name); 389 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
376 if (!maybe_code->ToObject(&code)) return maybe_code; 390 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
377 } 391 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
378 PROFILE(isolate_,
379 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
380 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
381 Object* result;
382 { MaybeObject* maybe_result =
383 receiver->UpdateMapCodeCache(name, Code::cast(code));
384 if (!maybe_result->ToObject(&result)) return maybe_result;
385 }
386 }
387 return code; 392 return code;
388 } 393 }
389 394
390 395
391 MaybeObject* StubCache::ComputeKeyedLoadCallback(String* name, 396 Handle<Code> KeyedLoadStubCompiler::CompileLoadCallback(
392 JSObject* receiver, 397 Handle<String> name,
393 JSObject* holder, 398 Handle<JSObject> object,
394 AccessorInfo* callback) { 399 Handle<JSObject> holder,
395 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); 400 Handle<AccessorInfo> callback) {
401 CALL_HEAP_FUNCTION(isolate(),
402 CompileLoadCallback(*name, *object, *holder, *callback),
403 Code);
404 }
405
406
407 Handle<Code> StubCache::ComputeKeyedLoadCallback(
408 Handle<String> name,
409 Handle<JSObject> receiver,
410 Handle<JSObject> holder,
411 Handle<AccessorInfo> callback) {
412 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP);
396 Code::Flags flags = 413 Code::Flags flags =
397 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 414 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
398 Object* code = receiver->map()->FindInCodeCache(name, flags); 415 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
399 if (code->IsUndefined()) { 416 if (probe->IsCode()) return Handle<Code>::cast(probe);
400 HandleScope scope(isolate_); 417
401 KeyedLoadStubCompiler compiler(isolate_); 418 KeyedLoadStubCompiler compiler(isolate_);
402 { MaybeObject* maybe_code = 419 Handle<Code> code =
403 compiler.CompileLoadCallback(name, receiver, holder, callback); 420 compiler.CompileLoadCallback(name, receiver, holder, callback);
404 if (!maybe_code->ToObject(&code)) return maybe_code; 421 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
405 } 422 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
406 PROFILE(isolate_, 423 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
407 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
408 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
409 Object* result;
410 { MaybeObject* maybe_result =
411 receiver->UpdateMapCodeCache(name, Code::cast(code));
412 if (!maybe_result->ToObject(&result)) return maybe_result;
413 }
414 }
415 return code; 424 return code;
416 } 425 }
417 426
418 427
428 Handle<Code> KeyedLoadStubCompiler::CompileLoadArrayLength(
429 Handle<String> name) {
430 CALL_HEAP_FUNCTION(isolate(),
431 CompileLoadArrayLength(*name),
432 Code);
433 }
419 434
420 MaybeObject* StubCache::ComputeKeyedLoadArrayLength(String* name, 435 Handle<Code> StubCache::ComputeKeyedLoadArrayLength(Handle<String> name,
421 JSArray* receiver) { 436 Handle<JSArray> receiver) {
422 Code::Flags flags = 437 Code::Flags flags =
423 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 438 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
424 ASSERT(receiver->IsJSObject()); 439 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
425 Object* code = receiver->map()->FindInCodeCache(name, flags); 440 if (probe->IsCode()) return Handle<Code>::cast(probe);
426 if (code->IsUndefined()) { 441
427 HandleScope scope(isolate_); 442 KeyedLoadStubCompiler compiler(isolate_);
428 KeyedLoadStubCompiler compiler(isolate_); 443 Handle<Code> code = compiler.CompileLoadArrayLength(name);
429 { MaybeObject* maybe_code = compiler.CompileLoadArrayLength(name); 444 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
430 if (!maybe_code->ToObject(&code)) return maybe_code; 445 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
431 } 446 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
432 PROFILE(isolate_,
433 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
434 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
435 Object* result;
436 { MaybeObject* maybe_result =
437 receiver->UpdateMapCodeCache(name, Code::cast(code));
438 if (!maybe_result->ToObject(&result)) return maybe_result;
439 }
440 }
441 return code; 447 return code;
442 } 448 }
443 449
444 450
445 MaybeObject* StubCache::ComputeKeyedLoadStringLength(String* name, 451 Handle<Code> KeyedLoadStubCompiler::CompileLoadStringLength(
446 String* receiver) { 452 Handle<String> name) {
453 CALL_HEAP_FUNCTION(isolate(),
454 CompileLoadStringLength(*name),
455 Code);
456 }
457
458 Handle<Code> StubCache::ComputeKeyedLoadStringLength(Handle<String> name,
459 Handle<String> receiver) {
447 Code::Flags flags = 460 Code::Flags flags =
448 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 461 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
449 Map* map = receiver->map(); 462 Handle<Map> map(receiver->map());
450 Object* code = map->FindInCodeCache(name, flags); 463 Handle<Object> probe(map->FindInCodeCache(*name, flags));
451 if (code->IsUndefined()) { 464 if (probe->IsCode()) return Handle<Code>::cast(probe);
452 HandleScope scope(isolate_); 465
453 KeyedLoadStubCompiler compiler(isolate_); 466 KeyedLoadStubCompiler compiler(isolate_);
454 { MaybeObject* maybe_code = compiler.CompileLoadStringLength(name); 467 Handle<Code> code = compiler.CompileLoadStringLength(name);
455 if (!maybe_code->ToObject(&code)) return maybe_code; 468 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
456 } 469 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
457 PROFILE(isolate_, 470 Map::UpdateCodeCache(map, name, code);
458 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
459 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
460 Object* result;
461 { MaybeObject* maybe_result = map->UpdateCodeCache(name, Code::cast(code));
462 if (!maybe_result->ToObject(&result)) return maybe_result;
463 }
464 }
465 return code; 471 return code;
466 } 472 }
467 473
468 474
469 MaybeObject* StubCache::ComputeKeyedLoadFunctionPrototype( 475 Handle<Code> KeyedLoadStubCompiler::CompileLoadFunctionPrototype(
470 String* name, 476 Handle<String> name) {
471 JSFunction* receiver) { 477 CALL_HEAP_FUNCTION(isolate(),
478 CompileLoadFunctionPrototype(*name),
479 Code);
480 }
481
482
483 Handle<Code> StubCache::ComputeKeyedLoadFunctionPrototype(
484 Handle<String> name,
485 Handle<JSFunction> receiver) {
472 Code::Flags flags = 486 Code::Flags flags =
473 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); 487 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS);
474 Object* code = receiver->map()->FindInCodeCache(name, flags); 488 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
475 if (code->IsUndefined()) { 489 if (probe->IsCode()) return Handle<Code>::cast(probe);
476 HandleScope scope(isolate_); 490
477 KeyedLoadStubCompiler compiler(isolate_); 491 KeyedLoadStubCompiler compiler(isolate_);
478 { MaybeObject* maybe_code = compiler.CompileLoadFunctionPrototype(name); 492 Handle<Code> code = compiler.CompileLoadFunctionPrototype(name);
479 if (!maybe_code->ToObject(&code)) return maybe_code; 493 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
480 } 494 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
481 PROFILE(isolate_, 495 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
482 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name));
483 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code)));
484 Object* result;
485 { MaybeObject* maybe_result =
486 receiver->UpdateMapCodeCache(name, Code::cast(code));
487 if (!maybe_result->ToObject(&result)) return maybe_result;
488 }
489 }
490 return code; 496 return code;
491 } 497 }
492 498
493 499
494 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object, 500 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object,
495 int index, 501 int index,
496 Handle<Map> transition, 502 Handle<Map> transition,
497 Handle<String> name) { 503 Handle<String> name) {
498 CALL_HEAP_FUNCTION(isolate(), 504 CALL_HEAP_FUNCTION(isolate(),
499 CompileStoreField(*object, 505 CompileStoreField(*object,
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 expected_receiver_type_ = 1931 expected_receiver_type_ =
1926 FunctionTemplateInfo::cast(signature->receiver()); 1932 FunctionTemplateInfo::cast(signature->receiver());
1927 } 1933 }
1928 } 1934 }
1929 1935
1930 is_simple_api_call_ = true; 1936 is_simple_api_call_ = true;
1931 } 1937 }
1932 1938
1933 1939
1934 } } // namespace v8::internal 1940 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698