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

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

Issue 1227893005: TypeofMode replaces TypeofState and ContextualMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 5 years, 5 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/ia32/lithium-ia32.h ('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"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 CallICState::CallType call_type); 347 CallICState::CallType call_type);
348 static Handle<Code> initialize_stub_in_optimized_code( 348 static Handle<Code> initialize_stub_in_optimized_code(
349 Isolate* isolate, int argc, CallICState::CallType call_type); 349 Isolate* isolate, int argc, CallICState::CallType call_type);
350 350
351 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); 351 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus);
352 }; 352 };
353 353
354 354
355 class LoadIC : public IC { 355 class LoadIC : public IC {
356 public: 356 public:
357 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, 357 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode,
358 LanguageMode language_mode) { 358 LanguageMode language_mode) {
359 return LoadICState(contextual_mode, language_mode).GetExtraICState(); 359 return LoadICState(typeof_mode, language_mode).GetExtraICState();
360 } 360 }
361 361
362 ContextualMode contextual_mode() const { 362 TypeofMode typeof_mode() const {
363 return LoadICState::GetContextualMode(extra_ic_state()); 363 return LoadICState::GetTypeofMode(extra_ic_state());
364 } 364 }
365 365
366 LanguageMode language_mode() const { 366 LanguageMode language_mode() const {
367 return LoadICState::GetLanguageMode(extra_ic_state()); 367 return LoadICState::GetLanguageMode(extra_ic_state());
368 } 368 }
369 369
370 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 370 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
371 : IC(depth, isolate, nexus) { 371 : IC(depth, isolate, nexus) {
372 DCHECK(nexus != NULL); 372 DCHECK(nexus != NULL);
373 DCHECK(IsLoadStub()); 373 DCHECK(IsLoadStub());
374 } 374 }
375 375
376 // TODO(mvstanton): The for_queries_only is because we have a case where we 376 // 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 377 // 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 378 // vector/slot information. for_queries_only is a temporary hack to enable the
379 // strong DCHECK protection around vector/slot. 379 // strong DCHECK protection around vector/slot.
380 LoadIC(FrameDepth depth, Isolate* isolate, bool for_queries_only) 380 LoadIC(FrameDepth depth, Isolate* isolate, bool for_queries_only)
381 : IC(depth, isolate, NULL, for_queries_only) { 381 : IC(depth, isolate, NULL, for_queries_only) {
382 DCHECK(IsLoadStub()); 382 DCHECK(IsLoadStub());
383 } 383 }
384 384
385 // Returns if this IC is for contextual (no explicit receiver) 385 bool ShouldThrowReferenceError(Handle<Object> receiver) {
386 // access to properties. 386 return receiver->IsGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF;
387 bool IsUndeclaredGlobal(Handle<Object> receiver) {
388 if (receiver->IsGlobalObject()) {
389 return contextual_mode() == CONTEXTUAL;
390 } else {
391 DCHECK(contextual_mode() != CONTEXTUAL);
392 return false;
393 }
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 GenerateRuntimeGetProperty(MacroAssembler* masm, 392 static void GenerateRuntimeGetProperty(MacroAssembler* masm,
400 LanguageMode language_mode); 393 LanguageMode language_mode);
401 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode); 394 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode);
402 395
403 static Handle<Code> initialize_stub(Isolate* isolate, 396 static Handle<Code> initialize_stub(Isolate* isolate,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 friend class IC; 438 friend class IC;
446 }; 439 };
447 440
448 441
449 class KeyedLoadIC : public LoadIC { 442 class KeyedLoadIC : public LoadIC {
450 public: 443 public:
451 // ExtraICState bits (building on IC) 444 // ExtraICState bits (building on IC)
452 class IcCheckTypeField 445 class IcCheckTypeField
453 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {}; 446 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {};
454 447
455 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, 448 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode,
456 LanguageMode language_mode, 449 LanguageMode language_mode,
457 IcCheckType key_type) { 450 IcCheckType key_type) {
458 return LoadICState(contextual_mode, language_mode).GetExtraICState() | 451 return LoadICState(typeof_mode, language_mode).GetExtraICState() |
459 IcCheckTypeField::encode(key_type); 452 IcCheckTypeField::encode(key_type);
460 } 453 }
461 454
462 static IcCheckType GetKeyType(ExtraICState extra_state) { 455 static IcCheckType GetKeyType(ExtraICState extra_state) {
463 return IcCheckTypeField::decode(extra_state); 456 return IcCheckTypeField::decode(extra_state);
464 } 457 }
465 458
466 KeyedLoadIC(FrameDepth depth, Isolate* isolate, 459 KeyedLoadIC(FrameDepth depth, Isolate* isolate,
467 KeyedLoadICNexus* nexus = NULL) 460 KeyedLoadICNexus* nexus = NULL)
468 : LoadIC(depth, isolate, nexus) { 461 : LoadIC(depth, isolate, nexus) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 759
767 // Support functions for interceptor handlers. 760 // Support functions for interceptor handlers.
768 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); 761 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly);
769 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); 762 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor);
770 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); 763 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor);
771 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); 764 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor);
772 } 765 }
773 } // namespace v8::internal 766 } // namespace v8::internal
774 767
775 #endif // V8_IC_H_ 768 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698