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

Side by Side Diff: src/ic.h

Issue 6594037: Strict Mode assignment to read only property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR Feedback. Created 9 years, 9 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/ia32/virtual-frame-ia32.cc ('k') | src/ic.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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // Support for patching the map that is checked in an inlined 391 // Support for patching the map that is checked in an inlined
392 // version of keyed load. 392 // version of keyed load.
393 static bool PatchInlinedLoad(Address address, Object* map); 393 static bool PatchInlinedLoad(Address address, Object* map);
394 394
395 friend class IC; 395 friend class IC;
396 }; 396 };
397 397
398 398
399 class StoreIC: public IC { 399 class StoreIC: public IC {
400 public: 400 public:
401
402 enum StoreICStrictMode {
403 kStoreICNonStrict = kNonStrictMode,
404 kStoreICStrict = kStrictMode
405 };
406
407 StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); } 401 StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); }
408 402
409 MUST_USE_RESULT MaybeObject* Store(State state, 403 MUST_USE_RESULT MaybeObject* Store(State state,
410 Code::ExtraICState extra_ic_state, 404 StrictModeFlag strict_mode,
411 Handle<Object> object, 405 Handle<Object> object,
412 Handle<String> name, 406 Handle<String> name,
413 Handle<Object> value); 407 Handle<Object> value);
414 408
415 // Code generators for stub routines. Only called once at startup. 409 // Code generators for stub routines. Only called once at startup.
416 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 410 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
417 static void GenerateMiss(MacroAssembler* masm); 411 static void GenerateMiss(MacroAssembler* masm);
418 static void GenerateMegamorphic(MacroAssembler* masm, 412 static void GenerateMegamorphic(MacroAssembler* masm,
419 Code::ExtraICState extra_ic_state); 413 StrictModeFlag strict_mode);
420 static void GenerateArrayLength(MacroAssembler* masm); 414 static void GenerateArrayLength(MacroAssembler* masm);
421 static void GenerateNormal(MacroAssembler* masm); 415 static void GenerateNormal(MacroAssembler* masm);
422 static void GenerateGlobalProxy(MacroAssembler* masm); 416 static void GenerateGlobalProxy(MacroAssembler* masm,
417 StrictModeFlag strict_mode);
423 418
424 // Clear the use of an inlined version. 419 // Clear the use of an inlined version.
425 static void ClearInlinedVersion(Address address); 420 static void ClearInlinedVersion(Address address);
426 421
427 // The offset from the inlined patch site to the start of the 422 // The offset from the inlined patch site to the start of the
428 // inlined store instruction. 423 // inlined store instruction.
429 static const int kOffsetToStoreInstruction; 424 static const int kOffsetToStoreInstruction;
430 425
431 private: 426 private:
432 // Update the inline cache and the global stub cache based on the 427 // Update the inline cache and the global stub cache based on the
433 // lookup result. 428 // lookup result.
434 void UpdateCaches(LookupResult* lookup, 429 void UpdateCaches(LookupResult* lookup,
435 State state, 430 State state,
436 Code::ExtraICState extra_ic_state, 431 StrictModeFlag strict_mode,
437 Handle<JSObject> receiver, 432 Handle<JSObject> receiver,
438 Handle<String> name, 433 Handle<String> name,
439 Handle<Object> value); 434 Handle<Object> value);
440 435
436 void set_target(Code* code) {
437 // Strict mode must be preserved across IC patching.
438 ASSERT((code->extra_ic_state() & kStrictMode) ==
439 (target()->extra_ic_state() & kStrictMode));
440 IC::set_target(code);
441 }
442
441 // Stub accessors. 443 // Stub accessors.
442 static Code* megamorphic_stub() { 444 static Code* megamorphic_stub() {
443 return Builtins::builtin(Builtins::StoreIC_Megamorphic); 445 return Builtins::builtin(Builtins::StoreIC_Megamorphic);
444 } 446 }
445 static Code* megamorphic_stub_strict() { 447 static Code* megamorphic_stub_strict() {
446 return Builtins::builtin(Builtins::StoreIC_Megamorphic_Strict); 448 return Builtins::builtin(Builtins::StoreIC_Megamorphic_Strict);
447 } 449 }
448 static Code* initialize_stub() { 450 static Code* initialize_stub() {
449 return Builtins::builtin(Builtins::StoreIC_Initialize); 451 return Builtins::builtin(Builtins::StoreIC_Initialize);
450 } 452 }
(...skipping 15 matching lines...) Expand all
466 468
467 friend class IC; 469 friend class IC;
468 }; 470 };
469 471
470 472
471 class KeyedStoreIC: public IC { 473 class KeyedStoreIC: public IC {
472 public: 474 public:
473 KeyedStoreIC() : IC(NO_EXTRA_FRAME) { } 475 KeyedStoreIC() : IC(NO_EXTRA_FRAME) { }
474 476
475 MUST_USE_RESULT MaybeObject* Store(State state, 477 MUST_USE_RESULT MaybeObject* Store(State state,
478 StrictModeFlag strict_mode,
476 Handle<Object> object, 479 Handle<Object> object,
477 Handle<Object> name, 480 Handle<Object> name,
478 Handle<Object> value); 481 Handle<Object> value);
479 482
480 // Code generators for stub routines. Only called once at startup. 483 // Code generators for stub routines. Only called once at startup.
481 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 484 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
482 static void GenerateMiss(MacroAssembler* masm); 485 static void GenerateMiss(MacroAssembler* masm);
483 static void GenerateRuntimeSetProperty(MacroAssembler* masm); 486 static void GenerateRuntimeSetProperty(MacroAssembler* masm,
484 static void GenerateGeneric(MacroAssembler* masm); 487 StrictModeFlag strict_mode);
488 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
485 489
486 // Clear the inlined version so the IC is always hit. 490 // Clear the inlined version so the IC is always hit.
487 static void ClearInlinedVersion(Address address); 491 static void ClearInlinedVersion(Address address);
488 492
489 // Restore the inlined version so the fast case can get hit. 493 // Restore the inlined version so the fast case can get hit.
490 static void RestoreInlinedVersion(Address address); 494 static void RestoreInlinedVersion(Address address);
491 495
492 private: 496 private:
493 // Update the inline cache. 497 // Update the inline cache.
494 void UpdateCaches(LookupResult* lookup, 498 void UpdateCaches(LookupResult* lookup,
495 State state, 499 State state,
500 StrictModeFlag strict_mode,
496 Handle<JSObject> receiver, 501 Handle<JSObject> receiver,
497 Handle<String> name, 502 Handle<String> name,
498 Handle<Object> value); 503 Handle<Object> value);
499 504
505 void set_target(Code* code) {
506 // Strict mode must be preserved across IC patching.
507 ASSERT((code->extra_ic_state() & kStrictMode) ==
508 (target()->extra_ic_state() & kStrictMode));
509 IC::set_target(code);
510 }
511
500 // Stub accessors. 512 // Stub accessors.
501 static Code* initialize_stub() { 513 static Code* initialize_stub() {
502 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize); 514 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize);
503 } 515 }
516 static Code* initialize_stub_strict() {
517 return Builtins::builtin(Builtins::KeyedStoreIC_Initialize_Strict);
518 }
504 static Code* megamorphic_stub() { 519 static Code* megamorphic_stub() {
505 return Builtins::builtin(Builtins::KeyedStoreIC_Generic); 520 return Builtins::builtin(Builtins::KeyedStoreIC_Generic);
506 } 521 }
522 static Code* megamorphic_stub_strict() {
523 return Builtins::builtin(Builtins::KeyedStoreIC_Generic_Strict);
524 }
507 static Code* generic_stub() { 525 static Code* generic_stub() {
508 return Builtins::builtin(Builtins::KeyedStoreIC_Generic); 526 return Builtins::builtin(Builtins::KeyedStoreIC_Generic);
509 } 527 }
528 static Code* generic_stub_strict() {
529 return Builtins::builtin(Builtins::KeyedStoreIC_Generic_Strict);
530 }
510 531
511 static void Clear(Address address, Code* target); 532 static void Clear(Address address, Code* target);
512 533
513 // Support for patching the map that is checked in an inlined 534 // Support for patching the map that is checked in an inlined
514 // version of keyed store. 535 // version of keyed store.
515 // The address is the patch point for the IC call 536 // The address is the patch point for the IC call
516 // (Assembler::kCallTargetAddressOffset before the end of 537 // (Assembler::kCallTargetAddressOffset before the end of
517 // the call/return address). 538 // the call/return address).
518 // The map is the new map that the inlined code should check against. 539 // The map is the new map that the inlined code should check against.
519 static bool PatchInlinedStore(Address address, Object* map); 540 static bool PatchInlinedStore(Address address, Object* map);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 630
610 Token::Value op_; 631 Token::Value op_;
611 }; 632 };
612 633
613 // Helper for TRBinaryOpIC and CompareIC. 634 // Helper for TRBinaryOpIC and CompareIC.
614 void PatchInlinedSmiCode(Address address); 635 void PatchInlinedSmiCode(Address address);
615 636
616 } } // namespace v8::internal 637 } } // namespace v8::internal
617 638
618 #endif // V8_IC_H_ 639 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698