OLD | NEW |
---|---|
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 Loading... | |
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 // Returns if this IC is for access to undeclared global property. |
386 // access to properties. | |
387 bool IsUndeclaredGlobal(Handle<Object> receiver) { | 386 bool IsUndeclaredGlobal(Handle<Object> receiver) { |
Toon Verwaest
2015/07/13 12:56:03
IsUndeclaredGlobal -> ShouldThrowReferenceError
Igor Sheludko
2015/07/13 13:08:02
Done.
| |
388 if (receiver->IsGlobalObject()) { | 387 return receiver->IsGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF; |
389 return contextual_mode() == CONTEXTUAL; | |
390 } else { | |
391 DCHECK(contextual_mode() != CONTEXTUAL); | |
392 return false; | |
393 } | |
394 } | 388 } |
395 | 389 |
396 // Code generator routines. | 390 // Code generator routines. |
397 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } | 391 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } |
398 static void GenerateMiss(MacroAssembler* masm); | 392 static void GenerateMiss(MacroAssembler* masm); |
399 static void GenerateRuntimeGetProperty(MacroAssembler* masm, | 393 static void GenerateRuntimeGetProperty(MacroAssembler* masm, |
400 LanguageMode language_mode); | 394 LanguageMode language_mode); |
401 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode); | 395 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode); |
402 | 396 |
403 static Handle<Code> initialize_stub(Isolate* isolate, | 397 static Handle<Code> initialize_stub(Isolate* isolate, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 friend class IC; | 439 friend class IC; |
446 }; | 440 }; |
447 | 441 |
448 | 442 |
449 class KeyedLoadIC : public LoadIC { | 443 class KeyedLoadIC : public LoadIC { |
450 public: | 444 public: |
451 // ExtraICState bits (building on IC) | 445 // ExtraICState bits (building on IC) |
452 class IcCheckTypeField | 446 class IcCheckTypeField |
453 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {}; | 447 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {}; |
454 | 448 |
455 static ExtraICState ComputeExtraICState(ContextualMode contextual_mode, | 449 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode, |
456 LanguageMode language_mode, | 450 LanguageMode language_mode, |
457 IcCheckType key_type) { | 451 IcCheckType key_type) { |
458 return LoadICState(contextual_mode, language_mode).GetExtraICState() | | 452 return LoadICState(typeof_mode, language_mode).GetExtraICState() | |
459 IcCheckTypeField::encode(key_type); | 453 IcCheckTypeField::encode(key_type); |
460 } | 454 } |
461 | 455 |
462 static IcCheckType GetKeyType(ExtraICState extra_state) { | 456 static IcCheckType GetKeyType(ExtraICState extra_state) { |
463 return IcCheckTypeField::decode(extra_state); | 457 return IcCheckTypeField::decode(extra_state); |
464 } | 458 } |
465 | 459 |
466 KeyedLoadIC(FrameDepth depth, Isolate* isolate, | 460 KeyedLoadIC(FrameDepth depth, Isolate* isolate, |
467 KeyedLoadICNexus* nexus = NULL) | 461 KeyedLoadICNexus* nexus = NULL) |
468 : LoadIC(depth, isolate, nexus) { | 462 : LoadIC(depth, isolate, nexus) { |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
766 | 760 |
767 // Support functions for interceptor handlers. | 761 // Support functions for interceptor handlers. |
768 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); | 762 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptorOnly); |
769 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); | 763 DECLARE_RUNTIME_FUNCTION(LoadPropertyWithInterceptor); |
770 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); | 764 DECLARE_RUNTIME_FUNCTION(LoadElementWithInterceptor); |
771 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); | 765 DECLARE_RUNTIME_FUNCTION(StorePropertyWithInterceptor); |
772 } | 766 } |
773 } // namespace v8::internal | 767 } // namespace v8::internal |
774 | 768 |
775 #endif // V8_IC_H_ | 769 #endif // V8_IC_H_ |
OLD | NEW |