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

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

Issue 6576024: (early draft) Strict mode - throw exception on assignment to read only property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Assign to read only property in strict mode. Created 9 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/stub-cache.h ('k') | src/x64/codegen-x64.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 } 492 }
493 return code; 493 return code;
494 } 494 }
495 495
496 496
497 MaybeObject* StubCache::ComputeStoreField(String* name, 497 MaybeObject* StubCache::ComputeStoreField(String* name,
498 JSObject* receiver, 498 JSObject* receiver,
499 int field_index, 499 int field_index,
500 Map* transition, 500 Map* transition,
501 Code::ExtraICState extra_ic_state) { 501 StrictModeFlag strict_mode) {
502 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; 502 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION;
503 Code::Flags flags = Code::ComputeMonomorphicFlags( 503 Code::Flags flags = Code::ComputeMonomorphicFlags(
504 Code::STORE_IC, type, extra_ic_state); 504 Code::STORE_IC, type, strict_mode);
505 Object* code = receiver->map()->FindInCodeCache(name, flags); 505 Object* code = receiver->map()->FindInCodeCache(name, flags);
506 if (code->IsUndefined()) { 506 if (code->IsUndefined()) {
507 StoreStubCompiler compiler(extra_ic_state); 507 StoreStubCompiler compiler(strict_mode);
508 { MaybeObject* maybe_code = 508 { MaybeObject* maybe_code =
509 compiler.CompileStoreField(receiver, field_index, transition, name); 509 compiler.CompileStoreField(receiver, field_index, transition, name);
510 if (!maybe_code->ToObject(&code)) return maybe_code; 510 if (!maybe_code->ToObject(&code)) return maybe_code;
511 } 511 }
512 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); 512 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
513 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); 513 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
514 Object* result; 514 Object* result;
515 { MaybeObject* maybe_result = 515 { MaybeObject* maybe_result =
516 receiver->UpdateMapCodeCache(name, Code::cast(code)); 516 receiver->UpdateMapCodeCache(name, Code::cast(code));
517 if (!maybe_result->ToObject(&result)) return maybe_result; 517 if (!maybe_result->ToObject(&result)) return maybe_result;
518 } 518 }
519 } 519 }
520 return code; 520 return code;
521 } 521 }
522 522
523 523
524 MaybeObject* StubCache::ComputeKeyedStoreSpecialized(JSObject* receiver) { 524 MaybeObject* StubCache::ComputeKeyedStoreSpecialized(
525 JSObject* receiver,
526 StrictModeFlag strict_mode) {
525 Code::Flags flags = 527 Code::Flags flags =
526 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL); 528 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode);
527 String* name = Heap::KeyedStoreSpecialized_symbol(); 529 String* name = Heap::KeyedStoreSpecialized_symbol();
528 Object* code = receiver->map()->FindInCodeCache(name, flags); 530 Object* code = receiver->map()->FindInCodeCache(name, flags);
529 if (code->IsUndefined()) { 531 if (code->IsUndefined()) {
530 KeyedStoreStubCompiler compiler; 532 KeyedStoreStubCompiler compiler(strict_mode);
531 { MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver); 533 { MaybeObject* maybe_code = compiler.CompileStoreSpecialized(receiver);
532 if (!maybe_code->ToObject(&code)) return maybe_code; 534 if (!maybe_code->ToObject(&code)) return maybe_code;
533 } 535 }
534 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); 536 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
535 Object* result; 537 Object* result;
536 { MaybeObject* maybe_result = 538 { MaybeObject* maybe_result =
537 receiver->UpdateMapCodeCache(name, Code::cast(code)); 539 receiver->UpdateMapCodeCache(name, Code::cast(code));
538 if (!maybe_result->ToObject(&result)) return maybe_result; 540 if (!maybe_result->ToObject(&result)) return maybe_result;
539 } 541 }
540 } 542 }
541 return code; 543 return code;
542 } 544 }
543 545
544 546
545 MaybeObject* StubCache::ComputeKeyedStorePixelArray(JSObject* receiver) { 547 MaybeObject* StubCache::ComputeKeyedStorePixelArray(
548 JSObject* receiver,
549 StrictModeFlag strict_mode) {
546 // Using NORMAL as the PropertyType for array element stores is a misuse. The 550 // Using NORMAL as the PropertyType for array element stores is a misuse. The
547 // generated stub always accesses fast elements, not slow-mode fields, but 551 // generated stub always accesses fast elements, not slow-mode fields, but
548 // some property type is required for the stub lookup. Note that overloading 552 // some property type is required for the stub lookup. Note that overloading
549 // the NORMAL PropertyType is only safe as long as no stubs are generated for 553 // the NORMAL PropertyType is only safe as long as no stubs are generated for
550 // other keyed field stores. This is guaranteed to be the case since all field 554 // other keyed field stores. This is guaranteed to be the case since all field
551 // keyed stores that are not array elements go through a generic builtin stub. 555 // keyed stores that are not array elements go through a generic builtin stub.
552 Code::Flags flags = 556 Code::Flags flags =
553 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL); 557 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode);
554 String* name = Heap::KeyedStorePixelArray_symbol(); 558 String* name = Heap::KeyedStorePixelArray_symbol();
555 Object* code = receiver->map()->FindInCodeCache(name, flags); 559 Object* code = receiver->map()->FindInCodeCache(name, flags);
556 if (code->IsUndefined()) { 560 if (code->IsUndefined()) {
557 KeyedStoreStubCompiler compiler; 561 KeyedStoreStubCompiler compiler(strict_mode);
558 { MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver); 562 { MaybeObject* maybe_code = compiler.CompileStorePixelArray(receiver);
559 if (!maybe_code->ToObject(&code)) return maybe_code; 563 if (!maybe_code->ToObject(&code)) return maybe_code;
560 } 564 }
561 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); 565 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
562 Object* result; 566 Object* result;
563 { MaybeObject* maybe_result = 567 { MaybeObject* maybe_result =
564 receiver->UpdateMapCodeCache(name, Code::cast(code)); 568 receiver->UpdateMapCodeCache(name, Code::cast(code));
565 if (!maybe_result->ToObject(&result)) return maybe_result; 569 if (!maybe_result->ToObject(&result)) return maybe_result;
566 } 570 }
567 } 571 }
(...skipping 23 matching lines...) Expand all
591 UNREACHABLE(); 595 UNREACHABLE();
592 return static_cast<ExternalArrayType>(0); 596 return static_cast<ExternalArrayType>(0);
593 } 597 }
594 } 598 }
595 599
596 } // anonymous namespace 600 } // anonymous namespace
597 601
598 602
599 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray( 603 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
600 JSObject* receiver, 604 JSObject* receiver,
601 bool is_store) { 605 bool is_store,
606 StrictModeFlag strict_mode) {
602 Code::Flags flags = 607 Code::Flags flags =
603 Code::ComputeMonomorphicFlags( 608 Code::ComputeMonomorphicFlags(
604 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC, 609 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC,
605 NORMAL); 610 NORMAL,
611 strict_mode);
606 ExternalArrayType array_type = 612 ExternalArrayType array_type =
607 ElementsKindToExternalArrayType(receiver->GetElementsKind()); 613 ElementsKindToExternalArrayType(receiver->GetElementsKind());
608 String* name = 614 String* name =
609 is_store ? Heap::KeyedStoreExternalArray_symbol() 615 is_store ? Heap::KeyedStoreExternalArray_symbol()
610 : Heap::KeyedLoadExternalArray_symbol(); 616 : Heap::KeyedLoadExternalArray_symbol();
611 // Use the global maps for the particular external array types, 617 // Use the global maps for the particular external array types,
612 // rather than the receiver's map, when looking up the cached code, 618 // rather than the receiver's map, when looking up the cached code,
613 // so that we actually canonicalize these stubs. 619 // so that we actually canonicalize these stubs.
614 Map* map = Heap::MapForExternalArrayType(array_type); 620 Map* map = Heap::MapForExternalArrayType(array_type);
615 Object* code = map->FindInCodeCache(name, flags); 621 Object* code = map->FindInCodeCache(name, flags);
616 if (code->IsUndefined()) { 622 if (code->IsUndefined()) {
617 ExternalArrayStubCompiler compiler; 623 ExternalArrayStubCompiler compiler;
618 { MaybeObject* maybe_code = 624 { MaybeObject* maybe_code = is_store
619 is_store ? compiler.CompileKeyedStoreStub(array_type, flags) : 625 ? compiler.CompileKeyedStoreStub(array_type, flags)
620 compiler.CompileKeyedLoadStub(array_type, flags); 626 : compiler.CompileKeyedLoadStub(array_type, flags);
621 if (!maybe_code->ToObject(&code)) return maybe_code; 627 if (!maybe_code->ToObject(&code)) return maybe_code;
622 } 628 }
623 if (is_store) { 629 if (is_store) {
624 PROFILE( 630 PROFILE(
625 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0)); 631 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
626 } else { 632 } else {
627 PROFILE( 633 PROFILE(
628 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0)); 634 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0));
629 } 635 }
630 Object* result; 636 Object* result;
631 { MaybeObject* maybe_result = 637 { MaybeObject* maybe_result =
632 map->UpdateCodeCache(name, Code::cast(code)); 638 map->UpdateCodeCache(name, Code::cast(code));
633 if (!maybe_result->ToObject(&result)) return maybe_result; 639 if (!maybe_result->ToObject(&result)) return maybe_result;
634 } 640 }
635 } 641 }
636 return code; 642 return code;
637 } 643 }
638 644
639 645
640 MaybeObject* StubCache::ComputeStoreNormal(Code::ExtraICState extra_ic_state) { 646 MaybeObject* StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) {
641 return Builtins::builtin(extra_ic_state == StoreIC::kStoreICStrict 647 return Builtins::builtin(strict_mode == kStrictMode
642 ? Builtins::StoreIC_Normal_Strict 648 ? Builtins::StoreIC_Normal_Strict
643 : Builtins::StoreIC_Normal); 649 : Builtins::StoreIC_Normal);
644 } 650 }
645 651
646 652
647 MaybeObject* StubCache::ComputeStoreGlobal(String* name, 653 MaybeObject* StubCache::ComputeStoreGlobal(String* name,
648 GlobalObject* receiver, 654 GlobalObject* receiver,
649 JSGlobalPropertyCell* cell, 655 JSGlobalPropertyCell* cell,
650 Code::ExtraICState extra_ic_state) { 656 StrictModeFlag strict_mode) {
651 Code::Flags flags = Code::ComputeMonomorphicFlags( 657 Code::Flags flags = Code::ComputeMonomorphicFlags(
652 Code::STORE_IC, NORMAL, extra_ic_state); 658 Code::STORE_IC, NORMAL, strict_mode);
653 Object* code = receiver->map()->FindInCodeCache(name, flags); 659 Object* code = receiver->map()->FindInCodeCache(name, flags);
654 if (code->IsUndefined()) { 660 if (code->IsUndefined()) {
655 StoreStubCompiler compiler(extra_ic_state); 661 StoreStubCompiler compiler(strict_mode);
656 { MaybeObject* maybe_code = 662 { MaybeObject* maybe_code =
657 compiler.CompileStoreGlobal(receiver, cell, name); 663 compiler.CompileStoreGlobal(receiver, cell, name);
658 if (!maybe_code->ToObject(&code)) return maybe_code; 664 if (!maybe_code->ToObject(&code)) return maybe_code;
659 } 665 }
660 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); 666 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
661 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); 667 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
662 Object* result; 668 Object* result;
663 { MaybeObject* maybe_result = 669 { MaybeObject* maybe_result =
664 receiver->UpdateMapCodeCache(name, Code::cast(code)); 670 receiver->UpdateMapCodeCache(name, Code::cast(code));
665 if (!maybe_result->ToObject(&result)) return maybe_result; 671 if (!maybe_result->ToObject(&result)) return maybe_result;
666 } 672 }
667 } 673 }
668 return code; 674 return code;
669 } 675 }
670 676
671 677
672 MaybeObject* StubCache::ComputeStoreCallback( 678 MaybeObject* StubCache::ComputeStoreCallback(
673 String* name, 679 String* name,
674 JSObject* receiver, 680 JSObject* receiver,
675 AccessorInfo* callback, 681 AccessorInfo* callback,
676 Code::ExtraICState extra_ic_state) { 682 StrictModeFlag strict_mode) {
677 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); 683 ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
678 Code::Flags flags = Code::ComputeMonomorphicFlags( 684 Code::Flags flags = Code::ComputeMonomorphicFlags(
679 Code::STORE_IC, CALLBACKS, extra_ic_state); 685 Code::STORE_IC, CALLBACKS, strict_mode);
680 Object* code = receiver->map()->FindInCodeCache(name, flags); 686 Object* code = receiver->map()->FindInCodeCache(name, flags);
681 if (code->IsUndefined()) { 687 if (code->IsUndefined()) {
682 StoreStubCompiler compiler(extra_ic_state); 688 StoreStubCompiler compiler(strict_mode);
683 { MaybeObject* maybe_code = 689 { MaybeObject* maybe_code =
684 compiler.CompileStoreCallback(receiver, callback, name); 690 compiler.CompileStoreCallback(receiver, callback, name);
685 if (!maybe_code->ToObject(&code)) return maybe_code; 691 if (!maybe_code->ToObject(&code)) return maybe_code;
686 } 692 }
687 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); 693 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
688 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); 694 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
689 Object* result; 695 Object* result;
690 { MaybeObject* maybe_result = 696 { MaybeObject* maybe_result =
691 receiver->UpdateMapCodeCache(name, Code::cast(code)); 697 receiver->UpdateMapCodeCache(name, Code::cast(code));
692 if (!maybe_result->ToObject(&result)) return maybe_result; 698 if (!maybe_result->ToObject(&result)) return maybe_result;
693 } 699 }
694 } 700 }
695 return code; 701 return code;
696 } 702 }
697 703
698 704
699 MaybeObject* StubCache::ComputeStoreInterceptor( 705 MaybeObject* StubCache::ComputeStoreInterceptor(
700 String* name, 706 String* name,
701 JSObject* receiver, 707 JSObject* receiver,
702 Code::ExtraICState extra_ic_state) { 708 StrictModeFlag strict_mode) {
703 Code::Flags flags = Code::ComputeMonomorphicFlags( 709 Code::Flags flags = Code::ComputeMonomorphicFlags(
704 Code::STORE_IC, INTERCEPTOR, extra_ic_state); 710 Code::STORE_IC, INTERCEPTOR, strict_mode);
705 Object* code = receiver->map()->FindInCodeCache(name, flags); 711 Object* code = receiver->map()->FindInCodeCache(name, flags);
706 if (code->IsUndefined()) { 712 if (code->IsUndefined()) {
707 StoreStubCompiler compiler(extra_ic_state); 713 StoreStubCompiler compiler(strict_mode);
708 { MaybeObject* maybe_code = 714 { MaybeObject* maybe_code =
709 compiler.CompileStoreInterceptor(receiver, name); 715 compiler.CompileStoreInterceptor(receiver, name);
710 if (!maybe_code->ToObject(&code)) return maybe_code; 716 if (!maybe_code->ToObject(&code)) return maybe_code;
711 } 717 }
712 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); 718 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
713 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); 719 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
714 Object* result; 720 Object* result;
715 { MaybeObject* maybe_result = 721 { MaybeObject* maybe_result =
716 receiver->UpdateMapCodeCache(name, Code::cast(code)); 722 receiver->UpdateMapCodeCache(name, Code::cast(code));
717 if (!maybe_result->ToObject(&result)) return maybe_result; 723 if (!maybe_result->ToObject(&result)) return maybe_result;
718 } 724 }
719 } 725 }
720 return code; 726 return code;
721 } 727 }
722 728
723 729
724 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, 730 MaybeObject* StubCache::ComputeKeyedStoreField(String* name,
725 JSObject* receiver, 731 JSObject* receiver,
726 int field_index, 732 int field_index,
727 Map* transition) { 733 Map* transition,
734 StrictModeFlag strict_mode) {
728 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; 735 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION;
729 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); 736 Code::Flags flags = Code::ComputeMonomorphicFlags(
737 Code::KEYED_STORE_IC, type, strict_mode);
730 Object* code = receiver->map()->FindInCodeCache(name, flags); 738 Object* code = receiver->map()->FindInCodeCache(name, flags);
731 if (code->IsUndefined()) { 739 if (code->IsUndefined()) {
732 KeyedStoreStubCompiler compiler; 740 KeyedStoreStubCompiler compiler(strict_mode);
733 { MaybeObject* maybe_code = 741 { MaybeObject* maybe_code =
734 compiler.CompileStoreField(receiver, field_index, transition, name); 742 compiler.CompileStoreField(receiver, field_index, transition, name);
735 if (!maybe_code->ToObject(&code)) return maybe_code; 743 if (!maybe_code->ToObject(&code)) return maybe_code;
736 } 744 }
737 PROFILE(CodeCreateEvent( 745 PROFILE(CodeCreateEvent(
738 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name)); 746 Logger::KEYED_STORE_IC_TAG, Code::cast(code), name));
739 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); 747 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code)));
740 Object* result; 748 Object* result;
741 { MaybeObject* maybe_result = 749 { MaybeObject* maybe_result =
742 receiver->UpdateMapCodeCache(name, Code::cast(code)); 750 receiver->UpdateMapCodeCache(name, Code::cast(code));
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 Address setter_address = v8::ToCData<Address>(callback->setter()); 1276 Address setter_address = v8::ToCData<Address>(callback->setter());
1269 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); 1277 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address);
1270 ASSERT(fun != NULL); 1278 ASSERT(fun != NULL);
1271 Handle<String> name = args.at<String>(2); 1279 Handle<String> name = args.at<String>(2);
1272 Handle<Object> value = args.at<Object>(3); 1280 Handle<Object> value = args.at<Object>(3);
1273 HandleScope scope; 1281 HandleScope scope;
1274 LOG(ApiNamedPropertyAccess("store", recv, *name)); 1282 LOG(ApiNamedPropertyAccess("store", recv, *name));
1275 CustomArguments custom_args(callback->data(), recv, recv); 1283 CustomArguments custom_args(callback->data(), recv, recv);
1276 v8::AccessorInfo info(custom_args.end()); 1284 v8::AccessorInfo info(custom_args.end());
1277 { 1285 {
1278 // Leaving JavaScript. 1286 // Leaving JavaScript. TODO(mmaly): Do we need strict mode here?
1279 VMState state(EXTERNAL); 1287 VMState state(EXTERNAL);
1280 ExternalCallbackScope call_scope(setter_address); 1288 ExternalCallbackScope call_scope(setter_address);
1281 fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); 1289 fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info);
1282 } 1290 }
1283 RETURN_IF_SCHEDULED_EXCEPTION(); 1291 RETURN_IF_SCHEDULED_EXCEPTION();
1284 return *value; 1292 return *value;
1285 } 1293 }
1286 1294
1287 1295
1288 static const int kAccessorInfoOffsetInInterceptorArgs = 2; 1296 static const int kAccessorInfoOffsetInInterceptorArgs = 2;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 MaybeObject* result = LoadWithInterceptor(&args, &attr); 1418 MaybeObject* result = LoadWithInterceptor(&args, &attr);
1411 RETURN_IF_SCHEDULED_EXCEPTION(); 1419 RETURN_IF_SCHEDULED_EXCEPTION();
1412 // This is call IC. In this case, we simply return the undefined result which 1420 // This is call IC. In this case, we simply return the undefined result which
1413 // will lead to an exception when trying to invoke the result as a 1421 // will lead to an exception when trying to invoke the result as a
1414 // function. 1422 // function.
1415 return result; 1423 return result;
1416 } 1424 }
1417 1425
1418 1426
1419 MaybeObject* StoreInterceptorProperty(Arguments args) { 1427 MaybeObject* StoreInterceptorProperty(Arguments args) {
1428 ASSERT(args.length() == 4);
1420 JSObject* recv = JSObject::cast(args[0]); 1429 JSObject* recv = JSObject::cast(args[0]);
1421 String* name = String::cast(args[1]); 1430 String* name = String::cast(args[1]);
1422 Object* value = args[2]; 1431 Object* value = args[2];
1432 StrictModeFlag strict =
1433 static_cast<StrictModeFlag>(Smi::cast(args[3])->value());
1434 ASSERT(strict == kStrictMode || strict == kNonStrictMode);
1423 ASSERT(recv->HasNamedInterceptor()); 1435 ASSERT(recv->HasNamedInterceptor());
1424 PropertyAttributes attr = NONE; 1436 PropertyAttributes attr = NONE;
1425 MaybeObject* result = recv->SetPropertyWithInterceptor(name, value, attr); 1437 MaybeObject* result = recv->SetPropertyWithInterceptor(
1438 name, value, attr, strict);
1426 return result; 1439 return result;
1427 } 1440 }
1428 1441
1429 1442
1430 MaybeObject* KeyedLoadPropertyWithInterceptor(Arguments args) { 1443 MaybeObject* KeyedLoadPropertyWithInterceptor(Arguments args) {
1431 JSObject* receiver = JSObject::cast(args[0]); 1444 JSObject* receiver = JSObject::cast(args[0]);
1432 ASSERT(Smi::cast(args[1])->value() >= 0); 1445 ASSERT(Smi::cast(args[1])->value() >= 0);
1433 uint32_t index = Smi::cast(args[1])->value(); 1446 uint32_t index = Smi::cast(args[1])->value();
1434 return receiver->GetElementWithInterceptor(receiver, index); 1447 return receiver->GetElementWithInterceptor(receiver, index);
1435 } 1448 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 name)); 1681 name));
1669 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, 1682 GDBJIT(AddCode(GDBJITInterface::LOAD_IC,
1670 name, 1683 name,
1671 Code::cast(result->ToObjectUnchecked()))); 1684 Code::cast(result->ToObjectUnchecked())));
1672 } 1685 }
1673 return result; 1686 return result;
1674 } 1687 }
1675 1688
1676 1689
1677 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) { 1690 MaybeObject* StoreStubCompiler::GetCode(PropertyType type, String* name) {
1678 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, type, 1691 Code::Flags flags = Code::ComputeMonomorphicFlags(
1679 extra_ic_state_); 1692 Code::STORE_IC, type, strict_mode_);
1680 MaybeObject* result = GetCodeWithFlags(flags, name); 1693 MaybeObject* result = GetCodeWithFlags(flags, name);
1681 if (!result->IsFailure()) { 1694 if (!result->IsFailure()) {
1682 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG, 1695 PROFILE(CodeCreateEvent(Logger::STORE_IC_TAG,
1683 Code::cast(result->ToObjectUnchecked()), 1696 Code::cast(result->ToObjectUnchecked()),
1684 name)); 1697 name));
1685 GDBJIT(AddCode(GDBJITInterface::STORE_IC, 1698 GDBJIT(AddCode(GDBJITInterface::STORE_IC,
1686 name, 1699 name,
1687 Code::cast(result->ToObjectUnchecked()))); 1700 Code::cast(result->ToObjectUnchecked())));
1688 } 1701 }
1689 return result; 1702 return result;
1690 } 1703 }
1691 1704
1692 1705
1693 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) { 1706 MaybeObject* KeyedStoreStubCompiler::GetCode(PropertyType type, String* name) {
1694 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, type); 1707 Code::Flags flags = Code::ComputeMonomorphicFlags(
1708 Code::KEYED_STORE_IC, type, strict_mode_);
1695 MaybeObject* result = GetCodeWithFlags(flags, name); 1709 MaybeObject* result = GetCodeWithFlags(flags, name);
1696 if (!result->IsFailure()) { 1710 if (!result->IsFailure()) {
1697 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, 1711 PROFILE(CodeCreateEvent(Logger::KEYED_STORE_IC_TAG,
1698 Code::cast(result->ToObjectUnchecked()), 1712 Code::cast(result->ToObjectUnchecked()),
1699 name)); 1713 name));
1700 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, 1714 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC,
1701 name, 1715 name,
1702 Code::cast(result->ToObjectUnchecked()))); 1716 Code::cast(result->ToObjectUnchecked())));
1703 } 1717 }
1704 return result; 1718 return result;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 if (!maybe_result->ToObject(&result)) return maybe_result; 1869 if (!maybe_result->ToObject(&result)) return maybe_result;
1856 } 1870 }
1857 Code* code = Code::cast(result); 1871 Code* code = Code::cast(result);
1858 USE(code); 1872 USE(code);
1859 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub")); 1873 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
1860 return result; 1874 return result;
1861 } 1875 }
1862 1876
1863 1877
1864 } } // namespace v8::internal 1878 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698