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

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

Issue 1700993002: Remove strong mode support from property loads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 4 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
« 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"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 static Handle<Code> initialize_stub_in_optimized_code( 289 static Handle<Code> initialize_stub_in_optimized_code(
290 Isolate* isolate, int argc, ConvertReceiverMode mode, 290 Isolate* isolate, int argc, ConvertReceiverMode mode,
291 TailCallMode tail_call_mode); 291 TailCallMode tail_call_mode);
292 292
293 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus); 293 static void Clear(Isolate* isolate, Code* host, CallICNexus* nexus);
294 }; 294 };
295 295
296 296
297 class LoadIC : public IC { 297 class LoadIC : public IC {
298 public: 298 public:
299 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode, 299 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode) {
300 LanguageMode language_mode) { 300 return LoadICState(typeof_mode).GetExtraICState();
301 return LoadICState(typeof_mode, language_mode).GetExtraICState();
302 } 301 }
303 302
304 TypeofMode typeof_mode() const { 303 TypeofMode typeof_mode() const {
305 return LoadICState::GetTypeofMode(extra_ic_state()); 304 return LoadICState::GetTypeofMode(extra_ic_state());
306 } 305 }
307 306
308 LanguageMode language_mode() const {
309 return LoadICState::GetLanguageMode(extra_ic_state());
310 }
311
312 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL) 307 LoadIC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus = NULL)
313 : IC(depth, isolate, nexus) { 308 : IC(depth, isolate, nexus) {
314 DCHECK(nexus != NULL); 309 DCHECK(nexus != NULL);
315 DCHECK(IsLoadStub()); 310 DCHECK(IsLoadStub());
316 } 311 }
317 312
318 bool ShouldThrowReferenceError(Handle<Object> receiver) { 313 bool ShouldThrowReferenceError(Handle<Object> receiver) {
319 return receiver->IsJSGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF; 314 return receiver->IsJSGlobalObject() && typeof_mode() == NOT_INSIDE_TYPEOF;
320 } 315 }
321 316
322 // Code generator routines. 317 // Code generator routines.
323 318
324 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 319 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
325 static void GenerateMiss(MacroAssembler* masm); 320 static void GenerateMiss(MacroAssembler* masm);
326 static void GenerateRuntimeGetProperty(MacroAssembler* masm, 321 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
327 LanguageMode language_mode); 322 static void GenerateNormal(MacroAssembler* masm);
328 static void GenerateNormal(MacroAssembler* masm, LanguageMode language_mode);
329 323
330 static Handle<Code> initialize_stub(Isolate* isolate, 324 static Handle<Code> initialize_stub(Isolate* isolate,
331 ExtraICState extra_state); 325 ExtraICState extra_state);
332 static Handle<Code> initialize_stub_in_optimized_code( 326 static Handle<Code> initialize_stub_in_optimized_code(
333 Isolate* isolate, ExtraICState extra_state, State initialization_state); 327 Isolate* isolate, ExtraICState extra_state, State initialization_state);
334 328
335 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 329 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
336 Handle<Name> name); 330 Handle<Name> name);
337 331
338 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus); 332 static void Clear(Isolate* isolate, Code* host, LoadICNexus* nexus);
339 333
340 protected: 334 protected:
341 inline void set_target(Code* code); 335 inline void set_target(Code* code);
342 336
343 Handle<Code> slow_stub() const { 337 Handle<Code> slow_stub() const {
344 if (kind() == Code::LOAD_IC) { 338 if (kind() == Code::LOAD_IC) {
345 return is_strong(language_mode()) 339 return isolate()->builtins()->LoadIC_Slow();
346 ? isolate()->builtins()->LoadIC_Slow_Strong()
347 : isolate()->builtins()->LoadIC_Slow();
348 } else { 340 } else {
349 DCHECK_EQ(Code::KEYED_LOAD_IC, kind()); 341 DCHECK_EQ(Code::KEYED_LOAD_IC, kind());
350 return is_strong(language_mode()) 342 return isolate()->builtins()->KeyedLoadIC_Slow();
351 ? isolate()->builtins()->KeyedLoadIC_Slow_Strong()
352 : isolate()->builtins()->KeyedLoadIC_Slow();
353 } 343 }
354 } 344 }
355 345
356 Handle<Code> megamorphic_stub() override; 346 Handle<Code> megamorphic_stub() override;
357 347
358 // Update the inline cache and the global stub cache based on the 348 // Update the inline cache and the global stub cache based on the
359 // lookup result. 349 // lookup result.
360 void UpdateCaches(LookupIterator* lookup); 350 void UpdateCaches(LookupIterator* lookup);
361 351
362 Handle<Code> CompileHandler(LookupIterator* lookup, Handle<Object> unused, 352 Handle<Code> CompileHandler(LookupIterator* lookup, Handle<Object> unused,
363 CacheHolderFlag cache_holder) override; 353 CacheHolderFlag cache_holder) override;
364 354
365 private: 355 private:
366 Handle<Code> SimpleFieldLoad(FieldIndex index); 356 Handle<Code> SimpleFieldLoad(FieldIndex index);
367 357
368 static void Clear(Isolate* isolate, Address address, Code* target, 358 static void Clear(Isolate* isolate, Address address, Code* target,
369 Address constant_pool); 359 Address constant_pool);
370 360
371 friend class IC; 361 friend class IC;
372 }; 362 };
373 363
374 364
375 class KeyedLoadIC : public LoadIC { 365 class KeyedLoadIC : public LoadIC {
376 public: 366 public:
377 // ExtraICState bits (building on IC) 367 // ExtraICState bits (building on IC)
378 class IcCheckTypeField 368 class IcCheckTypeField
379 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {}; 369 : public BitField<IcCheckType, LoadICState::kNextBitFieldOffset, 1> {};
380 370
381 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode, 371 static ExtraICState ComputeExtraICState(TypeofMode typeof_mode,
382 LanguageMode language_mode,
383 IcCheckType key_type) { 372 IcCheckType key_type) {
384 return LoadICState(typeof_mode, language_mode).GetExtraICState() | 373 return LoadICState(typeof_mode).GetExtraICState() |
385 IcCheckTypeField::encode(key_type); 374 IcCheckTypeField::encode(key_type);
386 } 375 }
387 376
388 static IcCheckType GetKeyType(ExtraICState extra_state) { 377 static IcCheckType GetKeyType(ExtraICState extra_state) {
389 return IcCheckTypeField::decode(extra_state); 378 return IcCheckTypeField::decode(extra_state);
390 } 379 }
391 380
392 KeyedLoadIC(FrameDepth depth, Isolate* isolate, 381 KeyedLoadIC(FrameDepth depth, Isolate* isolate,
393 KeyedLoadICNexus* nexus = NULL) 382 KeyedLoadICNexus* nexus = NULL)
394 : LoadIC(depth, isolate, nexus) { 383 : LoadIC(depth, isolate, nexus) {
395 DCHECK(nexus != NULL); 384 DCHECK(nexus != NULL);
396 DCHECK(target()->is_keyed_load_stub()); 385 DCHECK(target()->is_keyed_load_stub());
397 } 386 }
398 387
399 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object, 388 MUST_USE_RESULT MaybeHandle<Object> Load(Handle<Object> object,
400 Handle<Object> key); 389 Handle<Object> key);
401 390
402 // Code generator routines. 391 // Code generator routines.
403 static void GenerateMiss(MacroAssembler* masm); 392 static void GenerateMiss(MacroAssembler* masm);
404 static void GenerateRuntimeGetProperty(MacroAssembler* masm, 393 static void GenerateRuntimeGetProperty(MacroAssembler* masm);
405 LanguageMode language_mode);
406 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 394 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
407 static void GenerateMegamorphic(MacroAssembler* masm, 395 static void GenerateMegamorphic(MacroAssembler* masm);
408 LanguageMode language_mode);
409 396
410 // Bit mask to be tested against bit field for the cases when 397 // Bit mask to be tested against bit field for the cases when
411 // generic stub should go into slow case. 398 // generic stub should go into slow case.
412 // Access check is necessary explicitly since generic stub does not perform 399 // Access check is necessary explicitly since generic stub does not perform
413 // map checks. 400 // map checks.
414 static const int kSlowCaseBitFieldMask = 401 static const int kSlowCaseBitFieldMask =
415 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); 402 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
416 403
417 static Handle<Code> initialize_stub(Isolate* isolate, 404 static Handle<Code> initialize_stub(Isolate* isolate,
418 ExtraICState extra_state); 405 ExtraICState extra_state);
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 646
660 // Helper for BinaryOpIC and CompareIC. 647 // Helper for BinaryOpIC and CompareIC.
661 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; 648 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK };
662 void PatchInlinedSmiCode(Isolate* isolate, Address address, 649 void PatchInlinedSmiCode(Isolate* isolate, Address address,
663 InlinedSmiCheck check); 650 InlinedSmiCheck check);
664 651
665 } // namespace internal 652 } // namespace internal
666 } // namespace v8 653 } // namespace v8
667 654
668 #endif // V8_IC_H_ 655 #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