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

Side by Side Diff: src/ic.h

Issue 12038012: Merge Load from Keyed|Named load code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 | « no previous file | src/ic.cc » ('j') | src/ic.cc » ('J')
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 // 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Determines which map must be used for keeping the code stub. 126 // Determines which map must be used for keeping the code stub.
127 // These methods should not be called with undefined or null. 127 // These methods should not be called with undefined or null.
128 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object, 128 static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object,
129 JSObject* holder); 129 JSObject* holder);
130 static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object, 130 static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object,
131 JSObject* holder); 131 JSObject* holder);
132 static inline JSObject* GetCodeCacheHolder(Object* object, 132 static inline JSObject* GetCodeCacheHolder(Object* object,
133 InlineCacheHolderFlag holder); 133 InlineCacheHolderFlag holder);
134 134
135 MUST_USE_RESULT MaybeObject* Load(State state,
136 Handle<Object> object,
137 Handle<String> name);
138
135 protected: 139 protected:
136 virtual Handle<Code> pre_monomorphic_stub() { 140 virtual Handle<Code> pre_monomorphic_stub() {
137 UNREACHABLE(); 141 UNREACHABLE();
138 return Handle<Code>::null(); 142 return Handle<Code>::null();
139 } 143 }
140 virtual Handle<Code> megamorphic_stub() { 144 virtual Handle<Code> megamorphic_stub() {
141 UNREACHABLE(); 145 UNREACHABLE();
142 return Handle<Code>::null(); 146 return Handle<Code>::null();
143 } 147 }
148 virtual Handle<Code> generic_stub() const {
149 UNREACHABLE();
150 return Handle<Code>::null();
151 }
144 virtual Code::Kind kind() const { 152 virtual Code::Kind kind() const {
145 UNREACHABLE(); 153 UNREACHABLE();
146 return Code::STUB; 154 return Code::STUB;
147 } 155 }
156 virtual void UpdateLoadCaches(LookupResult* lookup,
157 State state,
158 Handle<Object> object,
159 Handle<String> name) {
160 UNREACHABLE();
161 }
148 Address fp() const { return fp_; } 162 Address fp() const { return fp_; }
149 Address pc() const { return *pc_address_; } 163 Address pc() const { return *pc_address_; }
150 Isolate* isolate() const { return isolate_; } 164 Isolate* isolate() const { return isolate_; }
151 165
152 #ifdef ENABLE_DEBUGGER_SUPPORT 166 #ifdef ENABLE_DEBUGGER_SUPPORT
153 // Computes the address in the original code when the code running is 167 // Computes the address in the original code when the code running is
154 // containing break points (calls to DebugBreakXXX builtins). 168 // containing break points (calls to DebugBreakXXX builtins).
155 Address OriginalCodeAddress() const; 169 Address OriginalCodeAddress() const;
156 #endif 170 #endif
157 171
(...skipping 12 matching lines...) Expand all
170 Failure* TypeError(const char* type, 184 Failure* TypeError(const char* type,
171 Handle<Object> object, 185 Handle<Object> object,
172 Handle<Object> key); 186 Handle<Object> key);
173 Failure* ReferenceError(const char* type, Handle<String> name); 187 Failure* ReferenceError(const char* type, Handle<String> name);
174 188
175 // Access the target code for the given IC address. 189 // Access the target code for the given IC address.
176 static inline Code* GetTargetAtAddress(Address address); 190 static inline Code* GetTargetAtAddress(Address address);
177 static inline void SetTargetAtAddress(Address address, Code* target); 191 static inline void SetTargetAtAddress(Address address, Code* target);
178 static void PostPatching(Address address, Code* target, Code* old_target); 192 static void PostPatching(Address address, Code* target, Code* old_target);
179 193
180 bool HandleLoad(State state,
181 Handle<Object> object,
182 Handle<String> name,
183 MaybeObject** result);
184
185 private: 194 private:
186 // Frame pointer for the frame that uses (calls) the IC. 195 // Frame pointer for the frame that uses (calls) the IC.
187 Address fp_; 196 Address fp_;
188 197
189 // All access to the program counter of an IC structure is indirect 198 // All access to the program counter of an IC structure is indirect
190 // to make the code GC safe. This feature is crucial since 199 // to make the code GC safe. This feature is crucial since
191 // GetProperty and SetProperty are called and they in turn might 200 // GetProperty and SetProperty are called and they in turn might
192 // invoke the garbage collector. 201 // invoke the garbage collector.
193 Address* pc_address_; 202 Address* pc_address_;
194 203
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 static void GenerateNonStrictArguments(MacroAssembler* masm, int argc); 342 static void GenerateNonStrictArguments(MacroAssembler* masm, int argc);
334 }; 343 };
335 344
336 345
337 class LoadIC: public IC { 346 class LoadIC: public IC {
338 public: 347 public:
339 explicit LoadIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) { 348 explicit LoadIC(Isolate* isolate) : IC(NO_EXTRA_FRAME, isolate) {
340 ASSERT(target()->is_load_stub()); 349 ASSERT(target()->is_load_stub());
341 } 350 }
342 351
343 MUST_USE_RESULT MaybeObject* Load(State state,
344 Handle<Object> object,
345 Handle<String> name);
346
347 // Code generator routines. 352 // Code generator routines.
348 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); } 353 static void GenerateInitialize(MacroAssembler* masm) { GenerateMiss(masm); }
349 static void GeneratePreMonomorphic(MacroAssembler* masm) { 354 static void GeneratePreMonomorphic(MacroAssembler* masm) {
350 GenerateMiss(masm); 355 GenerateMiss(masm);
351 } 356 }
352 static void GenerateMiss(MacroAssembler* masm); 357 static void GenerateMiss(MacroAssembler* masm);
353 static void GenerateMegamorphic(MacroAssembler* masm); 358 static void GenerateMegamorphic(MacroAssembler* masm);
354 static void GenerateNormal(MacroAssembler* masm); 359 static void GenerateNormal(MacroAssembler* masm);
355 360
356 // Specialized code generator routines. 361 // Specialized code generator routines.
357 static void GenerateArrayLength(MacroAssembler* masm); 362 static void GenerateArrayLength(MacroAssembler* masm);
358 static void GenerateFunctionPrototype(MacroAssembler* masm); 363 static void GenerateFunctionPrototype(MacroAssembler* masm);
359 364
360 protected: 365 protected:
361 virtual Code::Kind kind() const { return Code::LOAD_IC; } 366 virtual Code::Kind kind() const { return Code::LOAD_IC; }
362 367
363 virtual Handle<Code> megamorphic_stub() { 368 virtual Handle<Code> megamorphic_stub() {
364 return isolate()->builtins()->LoadIC_Megamorphic(); 369 return isolate()->builtins()->LoadIC_Megamorphic();
365 } 370 }
366 371
367 private:
368 // Update the inline cache and the global stub cache based on the 372 // Update the inline cache and the global stub cache based on the
369 // lookup result. 373 // lookup result.
370 void UpdateCaches(LookupResult* lookup, 374 virtual void UpdateLoadCaches(LookupResult* lookup,
371 State state, 375 State state,
372 Handle<Object> object, 376 Handle<Object> object,
373 Handle<String> name); 377 Handle<String> name);
374 378
379 private:
375 // Stub accessors. 380 // Stub accessors.
376 static Code* initialize_stub() { 381 static Code* initialize_stub() {
377 return Isolate::Current()->builtins()->builtin( 382 return Isolate::Current()->builtins()->builtin(
378 Builtins::kLoadIC_Initialize); 383 Builtins::kLoadIC_Initialize);
379 } 384 }
380 virtual Handle<Code> pre_monomorphic_stub() { 385 virtual Handle<Code> pre_monomorphic_stub() {
381 return isolate()->builtins()->LoadIC_PreMonomorphic(); 386 return isolate()->builtins()->LoadIC_PreMonomorphic();
382 } 387 }
383 388
384 static void Clear(Address address, Code* target); 389 static void Clear(Address address, Code* target);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 bool is_js_array, 538 bool is_js_array,
534 ElementsKind elements_kind, 539 ElementsKind elements_kind,
535 KeyedAccessGrowMode grow_mode); 540 KeyedAccessGrowMode grow_mode);
536 541
537 protected: 542 protected:
538 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } 543 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
539 544
540 virtual Handle<Code> megamorphic_stub() { 545 virtual Handle<Code> megamorphic_stub() {
541 return isolate()->builtins()->KeyedLoadIC_Generic(); 546 return isolate()->builtins()->KeyedLoadIC_Generic();
542 } 547 }
548 virtual Handle<Code> generic_stub() const {
549 return isolate()->builtins()->KeyedLoadIC_Generic();
550 }
543 551
544 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, 552 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps,
545 StrictModeFlag strict_mode, 553 StrictModeFlag strict_mode,
546 KeyedAccessGrowMode grow_mode); 554 KeyedAccessGrowMode grow_mode);
547 555
548 virtual Handle<Code> string_stub() { 556 virtual Handle<Code> string_stub() {
549 return isolate()->builtins()->KeyedLoadIC_String(); 557 return isolate()->builtins()->KeyedLoadIC_String();
550 } 558 }
551 559
560 // Update the inline cache.
561 virtual void UpdateLoadCaches(LookupResult* lookup,
562 State state,
563 Handle<Object> object,
564 Handle<String> name);
565
552 private: 566 private:
553 // Update the inline cache.
554 void UpdateCaches(LookupResult* lookup,
555 State state,
556 Handle<Object> object,
557 Handle<String> name);
558
559 // Stub accessors. 567 // Stub accessors.
560 static Code* initialize_stub() { 568 static Code* initialize_stub() {
561 return Isolate::Current()->builtins()->builtin( 569 return Isolate::Current()->builtins()->builtin(
562 Builtins::kKeyedLoadIC_Initialize); 570 Builtins::kKeyedLoadIC_Initialize);
563 } 571 }
564 Handle<Code> generic_stub() const {
565 return isolate()->builtins()->KeyedLoadIC_Generic();
566 }
567 virtual Handle<Code> pre_monomorphic_stub() { 572 virtual Handle<Code> pre_monomorphic_stub() {
568 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic(); 573 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic();
569 } 574 }
570 Handle<Code> indexed_interceptor_stub() { 575 Handle<Code> indexed_interceptor_stub() {
571 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); 576 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
572 } 577 }
573 Handle<Code> non_strict_arguments_stub() { 578 Handle<Code> non_strict_arguments_stub() {
574 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); 579 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments();
575 } 580 }
576 581
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 866
862 // Helper for BinaryOpIC and CompareIC. 867 // Helper for BinaryOpIC and CompareIC.
863 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; 868 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK };
864 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); 869 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check);
865 870
866 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss); 871 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss);
867 872
868 } } // namespace v8::internal 873 } } // namespace v8::internal
869 874
870 #endif // V8_IC_H_ 875 #endif // V8_IC_H_
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698