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

Side by Side Diff: src/ic/ic.h

Issue 1189153002: Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « src/ic/ia32/ic-ia32.cc ('k') | src/ic/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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IC_H_ 5 #ifndef V8_IC_H_
6 #define V8_IC_H_ 6 #define V8_IC_H_
7 7
8 #include "src/ic/ic-state.h" 8 #include "src/ic/ic-state.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 15
16 // IC_UTIL_LIST defines all utility functions called from generated 16 // IC_UTIL_LIST defines all utility functions called from generated
17 // inline caching code. The argument for the macro, ICU, is the function name. 17 // inline caching code. The argument for the macro, ICU, is the function name.
18 #define IC_UTIL_LIST(ICU) \ 18 #define IC_UTIL_LIST(ICU) \
19 ICU(LoadIC_Miss) \ 19 ICU(LoadIC_Miss) \
20 ICU(KeyedLoadIC_Miss) \ 20 ICU(KeyedLoadIC_Miss) \
21 ICU(LoadIC_Slow) \
22 ICU(KeyedLoadIC_Slow) \
23 ICU(CallIC_Miss) \ 21 ICU(CallIC_Miss) \
24 ICU(CallIC_Customization_Miss) \ 22 ICU(CallIC_Customization_Miss) \
25 ICU(StoreIC_Miss) \ 23 ICU(StoreIC_Miss) \
26 ICU(StoreIC_Slow) \ 24 ICU(StoreIC_Slow) \
27 ICU(KeyedStoreIC_Miss) \ 25 ICU(KeyedStoreIC_Miss) \
28 ICU(KeyedStoreIC_Slow) \ 26 ICU(KeyedStoreIC_Slow) \
29 /* Utilities for IC stubs. */ \ 27 /* Utilities for IC stubs. */ \
30 ICU(StoreCallbackProperty) \ 28 ICU(StoreCallbackProperty) \
31 ICU(LoadPropertyWithInterceptorOnly) \ 29 ICU(LoadPropertyWithInterceptorOnly) \
32 ICU(LoadPropertyWithInterceptor) \ 30 ICU(LoadPropertyWithInterceptor) \
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 CallICState::CallType call_type); 345 CallICState::CallType call_type);
348 static Handle<Code> initialize_stub_in_optimized_code( 346 static Handle<Code> initialize_stub_in_optimized_code(
349 Isolate* isolate, int argc, CallICState::CallType call_type); 347 Isolate* isolate, int argc, CallICState::CallType call_type);
350 348
351 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); 349 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus);
352 }; 350 };
353 351
354 352
355 class LoadIC : public IC { 353 class LoadIC : public IC {
356 public: 354 public:
357 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, 355 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode) {
358 LanguageMode language_mode) { 356 return LoadICState(contextual_mode).GetExtraICState();
359 return LoadICState(contextual_mode, language_mode).GetExtraICState();
360 } 357 }
361 358
362 ContextualMode contextual_mode() const { 359 ContextualMode contextual_mode() const {
363 return LoadICState::GetContextualMode(extra_ic_state()); 360 return LoadICState::GetContextualMode(extra_ic_state());
364 } 361 }
365 362
366 LanguageMode language_mode() const {
367 return LoadICState::GetLanguageMode(extra_ic_state());
368 }
369
370 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 363 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
371 : IC(depth, isolate, nexus) { 364 : IC(depth, isolate, nexus) {
372 DCHECK(nexus != NULL); 365 DCHECK(nexus != NULL);
373 DCHECK(IsLoadStub()); 366 DCHECK(IsLoadStub());
374 } 367 }
375 368
376 // TODO(mvstanton): The for_queries_only is because we have a case where we 369 // TODO(mvstanton): The for_queries_only is because we have a case where we
377 // construct an IC only to gather the contextual mode, and we don't have 370 // construct an IC only to gather the contextual mode, and we don't have
378 // vector/slot information. for_queries_only is a temporary hack to enable the 371 // vector/slot information. for_queries_only is a temporary hack to enable the
379 // strong DCHECK protection around vector/slot. 372 // strong DCHECK protection around vector/slot.
(...skipping 10 matching lines...) Expand all
390 } else { 383 } else {
391 DCHECK(contextual_mode() != CONTEXTUAL); 384 DCHECK(contextual_mode() != CONTEXTUAL);
392 return false; 385 return false;
393 } 386 }
394 } 387 }
395 388
396 // Code generator routines. 389 // Code generator routines.
397 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 390 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
398 static void GenerateMiss(MacroAssembler* masm); 391 static void GenerateMiss(MacroAssembler* masm);
399 static void GenerateNormal(MacroAssembler* masm); 392 static void GenerateNormal(MacroAssembler* masm);
400 static void GenerateSlow(MacroAssembler* masm); 393 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
401 394
402 static Handle<Code> initialize_stub(Isolate* isolate, 395 static Handle<Code> initialize_stub(Isolate* isolate,
403 ExtraICState extra_state); 396 ExtraICState extra_state);
404 static Handle<Code> initialize_stub_in_optimized_code( 397 static Handle<Code> initialize_stub_in_optimized_code(
405 Isolate* isolate, ExtraICState extra_state, State initialization_state); 398 Isolate* isolate, ExtraICState extra_state, State initialization_state);
406 399
407 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 400 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
408 Handle<Name> name); 401 Handle<Name> name);
409 402
410 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus); 403 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus);
(...skipping 26 matching lines...) Expand all
437 static void Clear(Isolate* isolate, Address address, Code* target, 430 static void Clear(Isolate* isolate, Address address, Code* target,
438 Address constant_pool); 431 Address constant_pool);
439 432
440 friend class IC; 433 friend class IC;
441 }; 434 };
442 435
443 436
444 class KeyedLoadIC : public LoadIC { 437 class KeyedLoadIC : public LoadIC {
445 public: 438 public:
446 // ExtraICState bits (building on IC) 439 // ExtraICState bits (building on IC)
447 class IcCheckTypeField : public BitField<IcCheckType, 2, 1> {}; 440 class IcCheckTypeField : public BitField<IcCheckType, 1, 1> {};
448 441
449 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, 442 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode,
450 LanguageMode language_mode,
451 IcCheckType key_type) { 443 IcCheckType key_type) {
452 return LoadICState(contextual_mode, language_mode).GetExtraICState() | 444 return LoadICState(contextual_mode).GetExtraICState() |
453 IcCheckTypeField::encode(key_type); 445 IcCheckTypeField::encode(key_type);
454 } 446 }
455 447
456 static IcCheckType GetKeyType(ExtraICState extra_state) { 448 static IcCheckType GetKeyType(ExtraICState extra_state) {
457 return IcCheckTypeField::decode(extra_state); 449 return IcCheckTypeField::decode(extra_state);
458 } 450 }
459 451
460 KeyedLoadIC(FrameDepth depth, Isolate* isolate, 452 KeyedLoadIC(FrameDepth depth, Isolate* isolate,
461 KeyedLoadICNexus* nexus = NULL) 453 KeyedLoadICNexus* nexus = NULL)
462 : LoadIC(depth, isolate, nexus) { 454 : LoadIC(depth, isolate, nexus) {
463 DCHECK(nexus != NULL); 455 DCHECK(nexus != NULL);
464 DCHECK(target()->is_keyed_load_stub()); 456 DCHECK(target()->is_keyed_load_stub());
465 } 457 }
466 458
467 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 459 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
468 Handle<Object> key); 460 Handle<Object> key);
469 461
470 // Code generator routines. 462 // Code generator routines.
471 static void GenerateMiss(MacroAssembler* masm); 463 static void GenerateMiss(MacroAssembler* masm);
472 static void GenerateSlow(MacroAssembler* masm); 464 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
473 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 465 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
474 static void GenerateMegamorphic(MacroAssembler* masm, 466 static void GenerateMegamorphic(MacroAssembler* masm);
475 LanguageMode languageMode);
476 467
477 // Bit mask to be tested against bit field for the cases when 468 // Bit mask to be tested against bit field for the cases when
478 // generic stub should go into slow case. 469 // generic stub should go into slow case.
479 // Access check is necessary explicitly since generic stub does not perform 470 // Access check is necessary explicitly since generic stub does not perform
480 // map checks. 471 // map checks.
481 static const int kSlowCaseBitFieldMask = 472 static const int kSlowCaseBitFieldMask =
482 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 473 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
483 474
484 static Handle<Code> initialize_stub(Isolate* isolate, 475 static Handle<Code> initialize_stub(Isolate* isolate);
485 ExtraICState extra_state);
486 static Handle<Code> initialize_stub_in_optimized_code( 476 static Handle<Code> initialize_stub_in_optimized_code(
487 Isolate* isolate, State initialization_state, ExtraICState extra_state); 477 Isolate* isolate, State initialization_state);
488 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate, 478 static Handle<Code> ChooseMegamorphicStub(Isolate* isolate);
489 ExtraICState extra_state);
490 479
491 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus); 480 static void Clear(Isolate* isolate, Code* host, KeyedLoadICNexus* nexus);
492 481
493 protected: 482 protected:
494 // receiver is HeapObject because it could be a String or a JSObject 483 // receiver is HeapObject because it could be a String or a JSObject
495 Handle<Code> LoadElementStub(Handle<HeapObject> receiver); 484 Handle<Code> LoadElementStub(Handle<HeapObject> receiver);
496 485
497 private: 486 private:
498 static void Clear(Isolate* isolate, Address address, Code* target, 487 static void Clear(Isolate* isolate, Address address, Code* target,
499 Address constant_pool); 488 Address constant_pool);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 736
748 // Support functions for interceptor handlers. 737 // Support functions for interceptor handlers.
749 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); 738 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly);
750 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); 739 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor);
751 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); 740 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor);
752 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); 741 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor);
753 } 742 }
754 } // namespace v8::internal 743 } // namespace v8::internal
755 744
756 #endif // V8_IC_H_ 745 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ic/ia32/ic-ia32.cc ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698