OLD | NEW |
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 enum Major { | 147 enum Major { |
148 UninitializedMajorKey = 0, | 148 UninitializedMajorKey = 0, |
149 #define DEF_ENUM(name) name, | 149 #define DEF_ENUM(name) name, |
150 CODE_STUB_LIST(DEF_ENUM) | 150 CODE_STUB_LIST(DEF_ENUM) |
151 #undef DEF_ENUM | 151 #undef DEF_ENUM |
152 NoCache, // marker for stubs that do custom caching | 152 NoCache, // marker for stubs that do custom caching |
153 NUMBER_OF_IDS | 153 NUMBER_OF_IDS |
154 }; | 154 }; |
155 | 155 |
156 // Retrieve the code for the stub. Generate the code if needed. | 156 // Retrieve the code for the stub. Generate the code if needed. |
157 Handle<Code> GetCode(Isolate* isolate); | 157 Handle<Code> GetCode(); |
158 | 158 |
159 // Retrieve the code for the stub, make and return a copy of the code. | 159 // Retrieve the code for the stub, make and return a copy of the code. |
160 Handle<Code> GetCodeCopy( | 160 Handle<Code> GetCodeCopy(const Code::FindAndReplacePattern& pattern); |
161 Isolate* isolate, const Code::FindAndReplacePattern& pattern); | |
162 | 161 |
163 static Major MajorKeyFromKey(uint32_t key) { | 162 static Major MajorKeyFromKey(uint32_t key) { |
164 return static_cast<Major>(MajorKeyBits::decode(key)); | 163 return static_cast<Major>(MajorKeyBits::decode(key)); |
165 } | 164 } |
166 static int MinorKeyFromKey(uint32_t key) { | 165 static int MinorKeyFromKey(uint32_t key) { |
167 return MinorKeyBits::decode(key); | 166 return MinorKeyBits::decode(key); |
168 } | 167 } |
169 | 168 |
170 // Gets the major key from a code object that is a code stub or binary op IC. | 169 // Gets the major key from a code object that is a code stub or binary op IC. |
171 static Major GetMajorKey(Code* code_stub) { | 170 static Major GetMajorKey(Code* code_stub) { |
(...skipping 10 matching lines...) Expand all Loading... |
182 | 181 |
183 // Some stubs put untagged junk on the stack that cannot be scanned by the | 182 // Some stubs put untagged junk on the stack that cannot be scanned by the |
184 // GC. This means that we must be statically sure that no GC can occur while | 183 // GC. This means that we must be statically sure that no GC can occur while |
185 // they are running. If that is the case they should override this to return | 184 // they are running. If that is the case they should override this to return |
186 // true, which will cause an assertion if we try to call something that can | 185 // true, which will cause an assertion if we try to call something that can |
187 // GC or if we try to put a stack frame on top of the junk, which would not | 186 // GC or if we try to put a stack frame on top of the junk, which would not |
188 // result in a traversable stack. | 187 // result in a traversable stack. |
189 virtual bool SometimesSetsUpAFrame() { return true; } | 188 virtual bool SometimesSetsUpAFrame() { return true; } |
190 | 189 |
191 // Lookup the code in the (possibly custom) cache. | 190 // Lookup the code in the (possibly custom) cache. |
192 bool FindCodeInCache(Code** code_out, Isolate* isolate); | 191 bool FindCodeInCache(Code** code_out); |
193 | 192 |
194 // Returns information for computing the number key. | 193 // Returns information for computing the number key. |
195 virtual Major MajorKey() = 0; | 194 virtual Major MajorKey() = 0; |
196 virtual int MinorKey() = 0; | 195 virtual int MinorKey() = 0; |
197 | 196 |
198 virtual InlineCacheState GetICState() { | 197 virtual InlineCacheState GetICState() { |
199 return UNINITIALIZED; | 198 return UNINITIALIZED; |
200 } | 199 } |
201 virtual ExtraICState GetExtraICState() { | 200 virtual ExtraICState GetExtraICState() { |
202 return kNoExtraICState; | 201 return kNoExtraICState; |
203 } | 202 } |
204 virtual Code::StubType GetStubType() { | 203 virtual Code::StubType GetStubType() { |
205 return Code::NORMAL; | 204 return Code::NORMAL; |
206 } | 205 } |
207 | 206 |
208 virtual void PrintName(StringStream* stream); | 207 virtual void PrintName(StringStream* stream); |
209 | 208 |
210 // Returns a name for logging/debugging purposes. | 209 // Returns a name for logging/debugging purposes. |
211 SmartArrayPointer<const char> GetName(); | 210 SmartArrayPointer<const char> GetName(); |
212 | 211 |
213 Isolate* isolate() const { return isolate_; } | 212 Isolate* isolate() const { return isolate_; } |
214 | 213 |
215 protected: | 214 protected: |
216 static bool CanUseFPRegisters(); | 215 static bool CanUseFPRegisters(); |
217 | 216 |
218 // Generates the assembler code for the stub. | 217 // Generates the assembler code for the stub. |
219 virtual Handle<Code> GenerateCode(Isolate* isolate) = 0; | 218 virtual Handle<Code> GenerateCode() = 0; |
220 | 219 |
221 virtual void VerifyPlatformFeatures(Isolate* isolate); | 220 virtual void VerifyPlatformFeatures(); |
222 | 221 |
223 // Returns whether the code generated for this stub needs to be allocated as | 222 // Returns whether the code generated for this stub needs to be allocated as |
224 // a fixed (non-moveable) code object. | 223 // a fixed (non-moveable) code object. |
225 virtual bool NeedsImmovableCode() { return false; } | 224 virtual bool NeedsImmovableCode() { return false; } |
226 | 225 |
227 virtual void PrintBaseName(StringStream* stream); | 226 virtual void PrintBaseName(StringStream* stream); |
228 virtual void PrintState(StringStream* stream) { } | 227 virtual void PrintState(StringStream* stream) { } |
229 | 228 |
230 private: | 229 private: |
231 // Perform bookkeeping required after code generation when stub code is | 230 // Perform bookkeeping required after code generation when stub code is |
232 // initially generated. | 231 // initially generated. |
233 void RecordCodeGeneration(Handle<Code> code, Isolate* isolate); | 232 void RecordCodeGeneration(Handle<Code> code); |
234 | 233 |
235 // Finish the code object after it has been generated. | 234 // Finish the code object after it has been generated. |
236 virtual void FinishCode(Handle<Code> code) { } | 235 virtual void FinishCode(Handle<Code> code) { } |
237 | 236 |
238 // Activate newly generated stub. Is called after | 237 // Activate newly generated stub. Is called after |
239 // registering stub in the stub cache. | 238 // registering stub in the stub cache. |
240 virtual void Activate(Code* code) { } | 239 virtual void Activate(Code* code) { } |
241 | 240 |
242 // BinaryOpStub needs to override this. | 241 // BinaryOpStub needs to override this. |
243 virtual Code::Kind GetCodeKind() const; | 242 virtual Code::Kind GetCodeKind() const; |
244 | 243 |
245 // Add the code to a specialized cache, specific to an individual | 244 // Add the code to a specialized cache, specific to an individual |
246 // stub type. Please note, this method must add the code object to a | 245 // stub type. Please note, this method must add the code object to a |
247 // roots object, otherwise we will remove the code during GC. | 246 // roots object, otherwise we will remove the code during GC. |
248 virtual void AddToSpecialCache(Handle<Code> new_object) { } | 247 virtual void AddToSpecialCache(Handle<Code> new_object) { } |
249 | 248 |
250 // Find code in a specialized cache, work is delegated to the specific stub. | 249 // Find code in a specialized cache, work is delegated to the specific stub. |
251 virtual bool FindCodeInSpecialCache(Code** code_out, Isolate* isolate) { | 250 virtual bool FindCodeInSpecialCache(Code** code_out) { |
252 return false; | 251 return false; |
253 } | 252 } |
254 | 253 |
255 // If a stub uses a special cache override this. | 254 // If a stub uses a special cache override this. |
256 virtual bool UseSpecialCache() { return false; } | 255 virtual bool UseSpecialCache() { return false; } |
257 | 256 |
258 // Computes the key based on major and minor. | 257 // Computes the key based on major and minor. |
259 uint32_t GetKey() { | 258 uint32_t GetKey() { |
260 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 259 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
261 return MinorKeyBits::encode(MinorKey()) | | 260 return MinorKeyBits::encode(MinorKey()) | |
262 MajorKeyBits::encode(MajorKey()); | 261 MajorKeyBits::encode(MajorKey()); |
263 } | 262 } |
264 | 263 |
265 STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits)); | 264 STATIC_ASSERT(NUMBER_OF_IDS < (1 << kStubMajorKeyBits)); |
266 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; | 265 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; |
267 class MinorKeyBits: public BitField<uint32_t, | 266 class MinorKeyBits: public BitField<uint32_t, |
268 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT | 267 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT |
269 | 268 |
270 friend class BreakPointIterator; | 269 friend class BreakPointIterator; |
271 | 270 |
272 Isolate* isolate_; | 271 Isolate* isolate_; |
273 }; | 272 }; |
274 | 273 |
275 | 274 |
276 class PlatformCodeStub : public CodeStub { | 275 class PlatformCodeStub : public CodeStub { |
277 public: | 276 public: |
278 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) { } | 277 explicit PlatformCodeStub(Isolate* isolate) : CodeStub(isolate) { } |
279 | 278 |
280 // Retrieve the code for the stub. Generate the code if needed. | 279 // Retrieve the code for the stub. Generate the code if needed. |
281 virtual Handle<Code> GenerateCode(Isolate* isolate); | 280 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
282 | 281 |
283 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 282 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
284 | 283 |
285 protected: | 284 protected: |
286 // Generates the assembler code for the stub. | 285 // Generates the assembler code for the stub. |
287 virtual void Generate(MacroAssembler* masm) = 0; | 286 virtual void Generate(MacroAssembler* masm) = 0; |
288 }; | 287 }; |
289 | 288 |
290 | 289 |
291 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; | 290 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 INITIALIZED | 391 INITIALIZED |
393 }; | 392 }; |
394 | 393 |
395 HydrogenCodeStub(Isolate* isolate, InitializationState state = INITIALIZED) | 394 HydrogenCodeStub(Isolate* isolate, InitializationState state = INITIALIZED) |
396 : CodeStub(isolate) { | 395 : CodeStub(isolate) { |
397 is_uninitialized_ = (state == UNINITIALIZED); | 396 is_uninitialized_ = (state == UNINITIALIZED); |
398 } | 397 } |
399 | 398 |
400 virtual Code::Kind GetCodeKind() const { return Code::STUB; } | 399 virtual Code::Kind GetCodeKind() const { return Code::STUB; } |
401 | 400 |
402 CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) { | 401 CodeStubInterfaceDescriptor* GetInterfaceDescriptor() { |
403 return isolate->code_stub_interface_descriptor(MajorKey()); | 402 return isolate()->code_stub_interface_descriptor(MajorKey()); |
404 } | 403 } |
405 | 404 |
406 bool IsUninitialized() { return is_uninitialized_; } | 405 bool IsUninitialized() { return is_uninitialized_; } |
407 | 406 |
408 template<class SubClass> | 407 template<class SubClass> |
409 static Handle<Code> GetUninitialized(Isolate* isolate) { | 408 static Handle<Code> GetUninitialized(Isolate* isolate) { |
410 SubClass::GenerateAheadOfTime(isolate); | 409 SubClass::GenerateAheadOfTime(isolate); |
411 return SubClass().GetCode(isolate); | 410 return SubClass().GetCode(isolate); |
412 } | 411 } |
413 | 412 |
414 virtual void InitializeInterfaceDescriptor( | 413 virtual void InitializeInterfaceDescriptor( |
415 Isolate* isolate, | |
416 CodeStubInterfaceDescriptor* descriptor) = 0; | 414 CodeStubInterfaceDescriptor* descriptor) = 0; |
417 | 415 |
418 // Retrieve the code for the stub. Generate the code if needed. | 416 // Retrieve the code for the stub. Generate the code if needed. |
419 virtual Handle<Code> GenerateCode(Isolate* isolate) = 0; | 417 virtual Handle<Code> GenerateCode() = 0; |
420 | 418 |
421 virtual int NotMissMinorKey() = 0; | 419 virtual int NotMissMinorKey() = 0; |
422 | 420 |
423 Handle<Code> GenerateLightweightMissCode(Isolate* isolate); | 421 Handle<Code> GenerateLightweightMissCode(); |
424 | 422 |
425 template<class StateType> | 423 template<class StateType> |
426 void TraceTransition(StateType from, StateType to); | 424 void TraceTransition(StateType from, StateType to); |
427 | 425 |
428 private: | 426 private: |
429 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {}; | 427 class MinorKeyBits: public BitField<int, 0, kStubMinorKeyBits - 1> {}; |
430 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; | 428 class IsMissBits: public BitField<bool, kStubMinorKeyBits - 1, 1> {}; |
431 | 429 |
432 void GenerateLightweightMiss(MacroAssembler* masm); | 430 void GenerateLightweightMiss(MacroAssembler* masm); |
433 virtual int MinorKey() { | 431 virtual int MinorKey() { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 virtual void BeforeCall(MacroAssembler* masm) const {} | 494 virtual void BeforeCall(MacroAssembler* masm) const {} |
497 | 495 |
498 virtual void AfterCall(MacroAssembler* masm) const {} | 496 virtual void AfterCall(MacroAssembler* masm) const {} |
499 }; | 497 }; |
500 | 498 |
501 | 499 |
502 class ToNumberStub: public HydrogenCodeStub { | 500 class ToNumberStub: public HydrogenCodeStub { |
503 public: | 501 public: |
504 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } | 502 explicit ToNumberStub(Isolate* isolate) : HydrogenCodeStub(isolate) { } |
505 | 503 |
506 virtual Handle<Code> GenerateCode(Isolate* isolate); | 504 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
507 | 505 |
508 virtual void InitializeInterfaceDescriptor( | 506 virtual void InitializeInterfaceDescriptor( |
509 Isolate* isolate, | 507 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
510 CodeStubInterfaceDescriptor* descriptor); | |
511 | 508 |
512 static void InstallDescriptors(Isolate* isolate) { | 509 static void InstallDescriptors(Isolate* isolate) { |
513 ToNumberStub stub(isolate); | 510 ToNumberStub stub(isolate); |
514 stub.InitializeInterfaceDescriptor( | 511 stub.InitializeInterfaceDescriptor( |
515 isolate, | |
516 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); | 512 isolate->code_stub_interface_descriptor(CodeStub::ToNumber)); |
517 } | 513 } |
518 | 514 |
519 private: | 515 private: |
520 Major MajorKey() { return ToNumber; } | 516 Major MajorKey() { return ToNumber; } |
521 int NotMissMinorKey() { return 0; } | 517 int NotMissMinorKey() { return 0; } |
522 }; | 518 }; |
523 | 519 |
524 | 520 |
525 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { | 521 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { |
526 public: | 522 public: |
527 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} | 523 explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} |
528 | 524 |
529 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 525 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
530 | 526 |
531 virtual void InitializeInterfaceDescriptor( | 527 virtual void InitializeInterfaceDescriptor( |
532 Isolate* isolate, | |
533 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 528 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
534 | 529 |
535 static void InstallDescriptors(Isolate* isolate); | 530 static void InstallDescriptors(Isolate* isolate); |
536 | 531 |
537 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 532 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
538 static const int kNumber = 0; | 533 static const int kNumber = 0; |
539 | 534 |
540 private: | 535 private: |
541 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } | 536 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } |
542 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } | 537 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } |
543 }; | 538 }; |
544 | 539 |
545 | 540 |
546 class FastNewClosureStub : public HydrogenCodeStub { | 541 class FastNewClosureStub : public HydrogenCodeStub { |
547 public: | 542 public: |
548 FastNewClosureStub(Isolate* isolate, | 543 FastNewClosureStub(Isolate* isolate, |
549 StrictMode strict_mode, | 544 StrictMode strict_mode, |
550 bool is_generator) | 545 bool is_generator) |
551 : HydrogenCodeStub(isolate), | 546 : HydrogenCodeStub(isolate), |
552 strict_mode_(strict_mode), | 547 strict_mode_(strict_mode), |
553 is_generator_(is_generator) { } | 548 is_generator_(is_generator) { } |
554 | 549 |
555 virtual Handle<Code> GenerateCode(Isolate* isolate); | 550 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
556 | 551 |
557 virtual void InitializeInterfaceDescriptor( | 552 virtual void InitializeInterfaceDescriptor( |
558 Isolate* isolate, | 553 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
559 CodeStubInterfaceDescriptor* descriptor); | |
560 | 554 |
561 static void InstallDescriptors(Isolate* isolate); | 555 static void InstallDescriptors(Isolate* isolate); |
562 | 556 |
563 StrictMode strict_mode() const { return strict_mode_; } | 557 StrictMode strict_mode() const { return strict_mode_; } |
564 bool is_generator() const { return is_generator_; } | 558 bool is_generator() const { return is_generator_; } |
565 | 559 |
566 private: | 560 private: |
567 class StrictModeBits: public BitField<bool, 0, 1> {}; | 561 class StrictModeBits: public BitField<bool, 0, 1> {}; |
568 class IsGeneratorBits: public BitField<bool, 1, 1> {}; | 562 class IsGeneratorBits: public BitField<bool, 1, 1> {}; |
569 | 563 |
(...skipping 10 matching lines...) Expand all Loading... |
580 | 574 |
581 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { | 575 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { |
582 public: | 576 public: |
583 static const int kMaximumSlots = 64; | 577 static const int kMaximumSlots = 64; |
584 | 578 |
585 FastNewContextStub(Isolate* isolate, int slots) | 579 FastNewContextStub(Isolate* isolate, int slots) |
586 : HydrogenCodeStub(isolate), slots_(slots) { | 580 : HydrogenCodeStub(isolate), slots_(slots) { |
587 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); | 581 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); |
588 } | 582 } |
589 | 583 |
590 virtual Handle<Code> GenerateCode(Isolate* isolate); | 584 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
591 | 585 |
592 virtual void InitializeInterfaceDescriptor( | 586 virtual void InitializeInterfaceDescriptor( |
593 Isolate* isolate, | 587 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
594 CodeStubInterfaceDescriptor* descriptor); | |
595 | 588 |
596 static void InstallDescriptors(Isolate* isolate); | 589 static void InstallDescriptors(Isolate* isolate); |
597 | 590 |
598 int slots() const { return slots_; } | 591 int slots() const { return slots_; } |
599 | 592 |
600 virtual Major MajorKey() V8_OVERRIDE { return FastNewContext; } | 593 virtual Major MajorKey() V8_OVERRIDE { return FastNewContext; } |
601 virtual int NotMissMinorKey() V8_OVERRIDE { return slots_; } | 594 virtual int NotMissMinorKey() V8_OVERRIDE { return slots_; } |
602 | 595 |
603 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 596 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
604 static const int kFunction = 0; | 597 static const int kFunction = 0; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 return FAST_ELEMENTS; | 640 return FAST_ELEMENTS; |
648 case CLONE_DOUBLE_ELEMENTS: | 641 case CLONE_DOUBLE_ELEMENTS: |
649 return FAST_DOUBLE_ELEMENTS; | 642 return FAST_DOUBLE_ELEMENTS; |
650 case CLONE_ANY_ELEMENTS: | 643 case CLONE_ANY_ELEMENTS: |
651 /*fall-through*/; | 644 /*fall-through*/; |
652 } | 645 } |
653 UNREACHABLE(); | 646 UNREACHABLE(); |
654 return LAST_ELEMENTS_KIND; | 647 return LAST_ELEMENTS_KIND; |
655 } | 648 } |
656 | 649 |
657 virtual Handle<Code> GenerateCode(Isolate* isolate); | 650 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
658 | 651 |
659 virtual void InitializeInterfaceDescriptor( | 652 virtual void InitializeInterfaceDescriptor( |
660 Isolate* isolate, | 653 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
661 CodeStubInterfaceDescriptor* descriptor); | |
662 | 654 |
663 static void InstallDescriptors(Isolate* isolate); | 655 static void InstallDescriptors(Isolate* isolate); |
664 | 656 |
665 private: | 657 private: |
666 Mode mode_; | 658 Mode mode_; |
667 AllocationSiteMode allocation_site_mode_; | 659 AllocationSiteMode allocation_site_mode_; |
668 int length_; | 660 int length_; |
669 | 661 |
670 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 662 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
671 class ModeBits: public BitField<Mode, 1, 4> {}; | 663 class ModeBits: public BitField<Mode, 1, 4> {}; |
(...skipping 17 matching lines...) Expand all Loading... |
689 static const int kMaximumClonedProperties = 6; | 681 static const int kMaximumClonedProperties = 6; |
690 | 682 |
691 FastCloneShallowObjectStub(Isolate* isolate, int length) | 683 FastCloneShallowObjectStub(Isolate* isolate, int length) |
692 : HydrogenCodeStub(isolate), length_(length) { | 684 : HydrogenCodeStub(isolate), length_(length) { |
693 ASSERT_GE(length_, 0); | 685 ASSERT_GE(length_, 0); |
694 ASSERT_LE(length_, kMaximumClonedProperties); | 686 ASSERT_LE(length_, kMaximumClonedProperties); |
695 } | 687 } |
696 | 688 |
697 int length() const { return length_; } | 689 int length() const { return length_; } |
698 | 690 |
699 virtual Handle<Code> GenerateCode(Isolate* isolate); | 691 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
700 | 692 |
701 virtual void InitializeInterfaceDescriptor( | 693 virtual void InitializeInterfaceDescriptor( |
702 Isolate* isolate, | 694 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
703 CodeStubInterfaceDescriptor* descriptor); | |
704 | 695 |
705 private: | 696 private: |
706 int length_; | 697 int length_; |
707 | 698 |
708 Major MajorKey() { return FastCloneShallowObject; } | 699 Major MajorKey() { return FastCloneShallowObject; } |
709 int NotMissMinorKey() { return length_; } | 700 int NotMissMinorKey() { return length_; } |
710 | 701 |
711 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 702 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
712 }; | 703 }; |
713 | 704 |
714 | 705 |
715 class CreateAllocationSiteStub : public HydrogenCodeStub { | 706 class CreateAllocationSiteStub : public HydrogenCodeStub { |
716 public: | 707 public: |
717 explicit CreateAllocationSiteStub(Isolate* isolate) | 708 explicit CreateAllocationSiteStub(Isolate* isolate) |
718 : HydrogenCodeStub(isolate) { } | 709 : HydrogenCodeStub(isolate) { } |
719 | 710 |
720 virtual Handle<Code> GenerateCode(Isolate* isolate); | 711 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
721 | 712 |
722 static void GenerateAheadOfTime(Isolate* isolate); | 713 static void GenerateAheadOfTime(Isolate* isolate); |
723 | 714 |
724 virtual void InitializeInterfaceDescriptor( | 715 virtual void InitializeInterfaceDescriptor( |
725 Isolate* isolate, | 716 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
726 CodeStubInterfaceDescriptor* descriptor); | |
727 | 717 |
728 private: | 718 private: |
729 Major MajorKey() { return CreateAllocationSite; } | 719 Major MajorKey() { return CreateAllocationSite; } |
730 int NotMissMinorKey() { return 0; } | 720 int NotMissMinorKey() { return 0; } |
731 | 721 |
732 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); | 722 DISALLOW_COPY_AND_ASSIGN(CreateAllocationSiteStub); |
733 }; | 723 }; |
734 | 724 |
735 | 725 |
736 class InstanceofStub: public PlatformCodeStub { | 726 class InstanceofStub: public PlatformCodeStub { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 | 904 |
915 class LoadFieldStub: public HandlerStub { | 905 class LoadFieldStub: public HandlerStub { |
916 public: | 906 public: |
917 LoadFieldStub(Isolate* isolate, | 907 LoadFieldStub(Isolate* isolate, |
918 bool inobject, | 908 bool inobject, |
919 int index, Representation representation) | 909 int index, Representation representation) |
920 : HandlerStub(isolate) { | 910 : HandlerStub(isolate) { |
921 Initialize(Code::LOAD_IC, inobject, index, representation); | 911 Initialize(Code::LOAD_IC, inobject, index, representation); |
922 } | 912 } |
923 | 913 |
924 virtual Handle<Code> GenerateCode(Isolate* isolate); | 914 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
925 | 915 |
926 virtual void InitializeInterfaceDescriptor( | 916 virtual void InitializeInterfaceDescriptor( |
927 Isolate* isolate, | 917 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
928 CodeStubInterfaceDescriptor* descriptor); | |
929 | 918 |
930 Representation representation() { | 919 Representation representation() { |
931 if (unboxed_double()) return Representation::Double(); | 920 if (unboxed_double()) return Representation::Double(); |
932 return Representation::Tagged(); | 921 return Representation::Tagged(); |
933 } | 922 } |
934 | 923 |
935 virtual Code::Kind kind() const { | 924 virtual Code::Kind kind() const { |
936 return KindBits::decode(bit_field_); | 925 return KindBits::decode(bit_field_); |
937 } | 926 } |
938 | 927 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; | 962 class UnboxedDoubleBits: public BitField<bool, 16, 1> {}; |
974 virtual CodeStub::Major MajorKey() { return LoadField; } | 963 virtual CodeStub::Major MajorKey() { return LoadField; } |
975 }; | 964 }; |
976 | 965 |
977 | 966 |
978 class StringLengthStub: public HandlerStub { | 967 class StringLengthStub: public HandlerStub { |
979 public: | 968 public: |
980 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) { | 969 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) { |
981 Initialize(Code::LOAD_IC); | 970 Initialize(Code::LOAD_IC); |
982 } | 971 } |
983 virtual Handle<Code> GenerateCode(Isolate* isolate); | 972 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
984 virtual void InitializeInterfaceDescriptor( | 973 virtual void InitializeInterfaceDescriptor( |
985 Isolate* isolate, | 974 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
986 CodeStubInterfaceDescriptor* descriptor); | |
987 | 975 |
988 protected: | 976 protected: |
989 virtual Code::Kind kind() const { | 977 virtual Code::Kind kind() const { |
990 return KindBits::decode(bit_field_); | 978 return KindBits::decode(bit_field_); |
991 } | 979 } |
992 | 980 |
993 void Initialize(Code::Kind kind) { | 981 void Initialize(Code::Kind kind) { |
994 bit_field_ = KindBits::encode(kind); | 982 bit_field_ = KindBits::encode(kind); |
995 } | 983 } |
996 | 984 |
997 private: | 985 private: |
998 virtual CodeStub::Major MajorKey() { return StringLength; } | 986 virtual CodeStub::Major MajorKey() { return StringLength; } |
999 }; | 987 }; |
1000 | 988 |
1001 | 989 |
1002 class KeyedStringLengthStub: public StringLengthStub { | 990 class KeyedStringLengthStub: public StringLengthStub { |
1003 public: | 991 public: |
1004 explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) { | 992 explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) { |
1005 Initialize(Code::KEYED_LOAD_IC); | 993 Initialize(Code::KEYED_LOAD_IC); |
1006 } | 994 } |
1007 virtual void InitializeInterfaceDescriptor( | 995 virtual void InitializeInterfaceDescriptor( |
1008 Isolate* isolate, | 996 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1009 CodeStubInterfaceDescriptor* descriptor); | |
1010 | 997 |
1011 private: | 998 private: |
1012 virtual CodeStub::Major MajorKey() { return KeyedStringLength; } | 999 virtual CodeStub::Major MajorKey() { return KeyedStringLength; } |
1013 }; | 1000 }; |
1014 | 1001 |
1015 | 1002 |
1016 class StoreGlobalStub : public HandlerStub { | 1003 class StoreGlobalStub : public HandlerStub { |
1017 public: | 1004 public: |
1018 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1005 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
1019 : HandlerStub(isolate) { | 1006 : HandlerStub(isolate) { |
1020 bit_field_ = IsConstantBits::encode(is_constant) | | 1007 bit_field_ = IsConstantBits::encode(is_constant) | |
1021 CheckGlobalBits::encode(check_global); | 1008 CheckGlobalBits::encode(check_global); |
1022 } | 1009 } |
1023 | 1010 |
1024 static Handle<HeapObject> global_placeholder(Isolate* isolate) { | 1011 static Handle<HeapObject> global_placeholder(Isolate* isolate) { |
1025 return isolate->factory()->uninitialized_value(); | 1012 return isolate->factory()->uninitialized_value(); |
1026 } | 1013 } |
1027 | 1014 |
1028 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, | 1015 Handle<Code> GetCodeCopyFromTemplate(Handle<GlobalObject> global, |
1029 Handle<GlobalObject> global, | |
1030 Handle<PropertyCell> cell) { | 1016 Handle<PropertyCell> cell) { |
1031 if (check_global()) { | 1017 if (check_global()) { |
1032 Code::FindAndReplacePattern pattern; | 1018 Code::FindAndReplacePattern pattern; |
1033 pattern.Add(Handle<Map>(global_placeholder(isolate)->map()), global); | 1019 pattern.Add(Handle<Map>(global_placeholder(isolate())->map()), global); |
1034 pattern.Add(isolate->factory()->meta_map(), Handle<Map>(global->map())); | 1020 pattern.Add(isolate()->factory()->meta_map(), Handle<Map>(global->map())); |
1035 pattern.Add(isolate->factory()->global_property_cell_map(), cell); | 1021 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); |
1036 return CodeStub::GetCodeCopy(isolate, pattern); | 1022 return CodeStub::GetCodeCopy(pattern); |
1037 } else { | 1023 } else { |
1038 Code::FindAndReplacePattern pattern; | 1024 Code::FindAndReplacePattern pattern; |
1039 pattern.Add(isolate->factory()->global_property_cell_map(), cell); | 1025 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); |
1040 return CodeStub::GetCodeCopy(isolate, pattern); | 1026 return CodeStub::GetCodeCopy(pattern); |
1041 } | 1027 } |
1042 } | 1028 } |
1043 | 1029 |
1044 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1030 virtual Code::Kind kind() const { return Code::STORE_IC; } |
1045 | 1031 |
1046 virtual Handle<Code> GenerateCode(Isolate* isolate); | 1032 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1047 | 1033 |
1048 virtual void InitializeInterfaceDescriptor( | 1034 virtual void InitializeInterfaceDescriptor( |
1049 Isolate* isolate, | 1035 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1050 CodeStubInterfaceDescriptor* descriptor); | |
1051 | 1036 |
1052 bool is_constant() const { | 1037 bool is_constant() const { |
1053 return IsConstantBits::decode(bit_field_); | 1038 return IsConstantBits::decode(bit_field_); |
1054 } | 1039 } |
1055 bool check_global() const { | 1040 bool check_global() const { |
1056 return CheckGlobalBits::decode(bit_field_); | 1041 return CheckGlobalBits::decode(bit_field_); |
1057 } | 1042 } |
1058 void set_is_constant(bool value) { | 1043 void set_is_constant(bool value) { |
1059 bit_field_ = IsConstantBits::update(bit_field_, value); | 1044 bit_field_ = IsConstantBits::update(bit_field_, value); |
1060 } | 1045 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 class KeyedLoadFieldStub: public LoadFieldStub { | 1106 class KeyedLoadFieldStub: public LoadFieldStub { |
1122 public: | 1107 public: |
1123 KeyedLoadFieldStub(Isolate* isolate, | 1108 KeyedLoadFieldStub(Isolate* isolate, |
1124 bool inobject, | 1109 bool inobject, |
1125 int index, Representation representation) | 1110 int index, Representation representation) |
1126 : LoadFieldStub(isolate) { | 1111 : LoadFieldStub(isolate) { |
1127 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation); | 1112 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation); |
1128 } | 1113 } |
1129 | 1114 |
1130 virtual void InitializeInterfaceDescriptor( | 1115 virtual void InitializeInterfaceDescriptor( |
1131 Isolate* isolate, | 1116 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1132 CodeStubInterfaceDescriptor* descriptor); | |
1133 | 1117 |
1134 private: | 1118 private: |
1135 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } | 1119 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } |
1136 }; | 1120 }; |
1137 | 1121 |
1138 | 1122 |
1139 class BinaryOpICStub : public HydrogenCodeStub { | 1123 class BinaryOpICStub : public HydrogenCodeStub { |
1140 public: | 1124 public: |
1141 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode) | 1125 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode) |
1142 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(op, mode) {} | 1126 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(op, mode) {} |
1143 | 1127 |
1144 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) | 1128 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) |
1145 : HydrogenCodeStub(isolate), state_(state) {} | 1129 : HydrogenCodeStub(isolate), state_(state) {} |
1146 | 1130 |
1147 static void GenerateAheadOfTime(Isolate* isolate); | 1131 static void GenerateAheadOfTime(Isolate* isolate); |
1148 | 1132 |
1149 virtual void InitializeInterfaceDescriptor( | 1133 virtual void InitializeInterfaceDescriptor( |
1150 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1134 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1151 | 1135 |
1152 static void InstallDescriptors(Isolate* isolate); | 1136 static void InstallDescriptors(Isolate* isolate); |
1153 | 1137 |
1154 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1138 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
1155 return Code::BINARY_OP_IC; | 1139 return Code::BINARY_OP_IC; |
1156 } | 1140 } |
1157 | 1141 |
1158 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { | 1142 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE { |
1159 return state_.GetICState(); | 1143 return state_.GetICState(); |
1160 } | 1144 } |
1161 | 1145 |
1162 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { | 1146 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE { |
1163 return state_.GetExtraICState(); | 1147 return state_.GetExtraICState(); |
1164 } | 1148 } |
1165 | 1149 |
1166 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_FINAL V8_OVERRIDE { | 1150 virtual void VerifyPlatformFeatures() V8_FINAL V8_OVERRIDE { |
1167 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1151 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
1168 } | 1152 } |
1169 | 1153 |
1170 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1154 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1171 | 1155 |
1172 const BinaryOpIC::State& state() const { return state_; } | 1156 const BinaryOpIC::State& state() const { return state_; } |
1173 | 1157 |
1174 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; | 1158 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE; |
1175 | 1159 |
1176 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } | 1160 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpIC; } |
1177 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { | 1161 virtual int NotMissMinorKey() V8_FINAL V8_OVERRIDE { |
1178 return GetExtraICState(); | 1162 return GetExtraICState(); |
1179 } | 1163 } |
1180 | 1164 |
(...skipping 14 matching lines...) Expand all Loading... |
1195 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail | 1179 // TODO(bmeurer): Merge this into the BinaryOpICStub once we have proper tail |
1196 // call support for stubs in Hydrogen. | 1180 // call support for stubs in Hydrogen. |
1197 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { | 1181 class BinaryOpICWithAllocationSiteStub V8_FINAL : public PlatformCodeStub { |
1198 public: | 1182 public: |
1199 BinaryOpICWithAllocationSiteStub(Isolate* isolate, | 1183 BinaryOpICWithAllocationSiteStub(Isolate* isolate, |
1200 const BinaryOpIC::State& state) | 1184 const BinaryOpIC::State& state) |
1201 : PlatformCodeStub(isolate), state_(state) {} | 1185 : PlatformCodeStub(isolate), state_(state) {} |
1202 | 1186 |
1203 static void GenerateAheadOfTime(Isolate* isolate); | 1187 static void GenerateAheadOfTime(Isolate* isolate); |
1204 | 1188 |
1205 Handle<Code> GetCodeCopyFromTemplate(Isolate* isolate, | 1189 Handle<Code> GetCodeCopyFromTemplate(Handle<AllocationSite> allocation_site) { |
1206 Handle<AllocationSite> allocation_site) { | |
1207 Code::FindAndReplacePattern pattern; | 1190 Code::FindAndReplacePattern pattern; |
1208 pattern.Add(isolate->factory()->undefined_map(), allocation_site); | 1191 pattern.Add(isolate()->factory()->undefined_map(), allocation_site); |
1209 return CodeStub::GetCodeCopy(isolate, pattern); | 1192 return CodeStub::GetCodeCopy(pattern); |
1210 } | 1193 } |
1211 | 1194 |
1212 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { | 1195 virtual Code::Kind GetCodeKind() const V8_OVERRIDE { |
1213 return Code::BINARY_OP_IC; | 1196 return Code::BINARY_OP_IC; |
1214 } | 1197 } |
1215 | 1198 |
1216 virtual InlineCacheState GetICState() V8_OVERRIDE { | 1199 virtual InlineCacheState GetICState() V8_OVERRIDE { |
1217 return state_.GetICState(); | 1200 return state_.GetICState(); |
1218 } | 1201 } |
1219 | 1202 |
1220 virtual ExtraICState GetExtraICState() V8_OVERRIDE { | 1203 virtual ExtraICState GetExtraICState() V8_OVERRIDE { |
1221 return state_.GetExtraICState(); | 1204 return state_.GetExtraICState(); |
1222 } | 1205 } |
1223 | 1206 |
1224 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1207 virtual void VerifyPlatformFeatures() V8_OVERRIDE { |
1225 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1208 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
1226 } | 1209 } |
1227 | 1210 |
1228 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1211 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
1229 | 1212 |
1230 virtual void PrintState(StringStream* stream) V8_OVERRIDE; | 1213 virtual void PrintState(StringStream* stream) V8_OVERRIDE; |
1231 | 1214 |
1232 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } | 1215 virtual Major MajorKey() V8_OVERRIDE { return BinaryOpICWithAllocationSite; } |
1233 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } | 1216 virtual int MinorKey() V8_OVERRIDE { return GetExtraICState(); } |
1234 | 1217 |
(...skipping 12 matching lines...) Expand all Loading... |
1247 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1230 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
1248 Token::Value op, | 1231 Token::Value op, |
1249 OverwriteMode mode) | 1232 OverwriteMode mode) |
1250 : BinaryOpICStub(isolate, op, mode) {} | 1233 : BinaryOpICStub(isolate, op, mode) {} |
1251 | 1234 |
1252 BinaryOpWithAllocationSiteStub(Isolate* isolate, | 1235 BinaryOpWithAllocationSiteStub(Isolate* isolate, |
1253 const BinaryOpIC::State& state) | 1236 const BinaryOpIC::State& state) |
1254 : BinaryOpICStub(isolate, state) {} | 1237 : BinaryOpICStub(isolate, state) {} |
1255 | 1238 |
1256 virtual void InitializeInterfaceDescriptor( | 1239 virtual void InitializeInterfaceDescriptor( |
1257 Isolate* isolate, CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1240 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1258 | 1241 |
1259 static void InstallDescriptors(Isolate* isolate); | 1242 static void InstallDescriptors(Isolate* isolate); |
1260 | 1243 |
1261 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { | 1244 virtual Code::Kind GetCodeKind() const V8_FINAL V8_OVERRIDE { |
1262 return Code::STUB; | 1245 return Code::STUB; |
1263 } | 1246 } |
1264 | 1247 |
1265 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1248 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1266 | 1249 |
1267 virtual Major MajorKey() V8_OVERRIDE { | 1250 virtual Major MajorKey() V8_OVERRIDE { |
1268 return BinaryOpWithAllocationSite; | 1251 return BinaryOpWithAllocationSite; |
1269 } | 1252 } |
1270 | 1253 |
1271 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1254 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1272 static const int kAllocationSite = 0; | 1255 static const int kAllocationSite = 0; |
1273 static const int kLeft = 1; | 1256 static const int kLeft = 1; |
1274 static const int kRight = 2; | 1257 static const int kRight = 2; |
1275 }; | 1258 }; |
(...skipping 21 matching lines...) Expand all Loading... |
1297 PretenureFlagBits::encode(pretenure_flag)) {} | 1280 PretenureFlagBits::encode(pretenure_flag)) {} |
1298 | 1281 |
1299 StringAddFlags flags() const { | 1282 StringAddFlags flags() const { |
1300 return StringAddFlagsBits::decode(bit_field_); | 1283 return StringAddFlagsBits::decode(bit_field_); |
1301 } | 1284 } |
1302 | 1285 |
1303 PretenureFlag pretenure_flag() const { | 1286 PretenureFlag pretenure_flag() const { |
1304 return PretenureFlagBits::decode(bit_field_); | 1287 return PretenureFlagBits::decode(bit_field_); |
1305 } | 1288 } |
1306 | 1289 |
1307 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1290 virtual void VerifyPlatformFeatures() V8_OVERRIDE { |
1308 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1291 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
1309 } | 1292 } |
1310 | 1293 |
1311 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1294 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1312 | 1295 |
1313 virtual void InitializeInterfaceDescriptor( | 1296 virtual void InitializeInterfaceDescriptor( |
1314 Isolate* isolate, | |
1315 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1297 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1316 | 1298 |
1317 static void InstallDescriptors(Isolate* isolate); | 1299 static void InstallDescriptors(Isolate* isolate); |
1318 | 1300 |
1319 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1301 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1320 static const int kLeft = 0; | 1302 static const int kLeft = 0; |
1321 static const int kRight = 1; | 1303 static const int kRight = 1; |
1322 | 1304 |
1323 private: | 1305 private: |
1324 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; | 1306 class StringAddFlagsBits: public BitField<StringAddFlags, 0, 2> {}; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 void GenerateUniqueNames(MacroAssembler* masm); | 1365 void GenerateUniqueNames(MacroAssembler* masm); |
1384 void GenerateObjects(MacroAssembler* masm); | 1366 void GenerateObjects(MacroAssembler* masm); |
1385 void GenerateMiss(MacroAssembler* masm); | 1367 void GenerateMiss(MacroAssembler* masm); |
1386 void GenerateKnownObjects(MacroAssembler* masm); | 1368 void GenerateKnownObjects(MacroAssembler* masm); |
1387 void GenerateGeneric(MacroAssembler* masm); | 1369 void GenerateGeneric(MacroAssembler* masm); |
1388 | 1370 |
1389 bool strict() const { return op_ == Token::EQ_STRICT; } | 1371 bool strict() const { return op_ == Token::EQ_STRICT; } |
1390 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } | 1372 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } |
1391 | 1373 |
1392 virtual void AddToSpecialCache(Handle<Code> new_object); | 1374 virtual void AddToSpecialCache(Handle<Code> new_object); |
1393 virtual bool FindCodeInSpecialCache(Code** code_out, Isolate* isolate); | 1375 virtual bool FindCodeInSpecialCache(Code** code_out); |
1394 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECT; } | 1376 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECT; } |
1395 | 1377 |
1396 Token::Value op_; | 1378 Token::Value op_; |
1397 CompareIC::State left_; | 1379 CompareIC::State left_; |
1398 CompareIC::State right_; | 1380 CompareIC::State right_; |
1399 CompareIC::State state_; | 1381 CompareIC::State state_; |
1400 Handle<Map> known_map_; | 1382 Handle<Map> known_map_; |
1401 }; | 1383 }; |
1402 | 1384 |
1403 | 1385 |
1404 class CompareNilICStub : public HydrogenCodeStub { | 1386 class CompareNilICStub : public HydrogenCodeStub { |
1405 public: | 1387 public: |
1406 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); | 1388 Type* GetType(Zone* zone, Handle<Map> map = Handle<Map>()); |
1407 Type* GetInputType(Zone* zone, Handle<Map> map); | 1389 Type* GetInputType(Zone* zone, Handle<Map> map); |
1408 | 1390 |
1409 CompareNilICStub(Isolate* isolate, NilValue nil) | 1391 CompareNilICStub(Isolate* isolate, NilValue nil) |
1410 : HydrogenCodeStub(isolate), nil_value_(nil) { } | 1392 : HydrogenCodeStub(isolate), nil_value_(nil) { } |
1411 | 1393 |
1412 CompareNilICStub(Isolate* isolate, | 1394 CompareNilICStub(Isolate* isolate, |
1413 ExtraICState ic_state, | 1395 ExtraICState ic_state, |
1414 InitializationState init_state = INITIALIZED) | 1396 InitializationState init_state = INITIALIZED) |
1415 : HydrogenCodeStub(isolate, init_state), | 1397 : HydrogenCodeStub(isolate, init_state), |
1416 nil_value_(NilValueField::decode(ic_state)), | 1398 nil_value_(NilValueField::decode(ic_state)), |
1417 state_(State(TypesField::decode(ic_state))) { | 1399 state_(State(TypesField::decode(ic_state))) { |
1418 } | 1400 } |
1419 | 1401 |
1420 static Handle<Code> GetUninitialized(Isolate* isolate, | 1402 static Handle<Code> GetUninitialized(Isolate* isolate, |
1421 NilValue nil) { | 1403 NilValue nil) { |
1422 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(isolate); | 1404 return CompareNilICStub(isolate, nil, UNINITIALIZED).GetCode(); |
1423 } | 1405 } |
1424 | 1406 |
1425 virtual void InitializeInterfaceDescriptor( | 1407 virtual void InitializeInterfaceDescriptor( |
1426 Isolate* isolate, | 1408 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1427 CodeStubInterfaceDescriptor* descriptor); | |
1428 | 1409 |
1429 static void InstallDescriptors(Isolate* isolate) { | 1410 static void InstallDescriptors(Isolate* isolate) { |
1430 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED); | 1411 CompareNilICStub compare_stub(isolate, kNullValue, UNINITIALIZED); |
1431 compare_stub.InitializeInterfaceDescriptor( | 1412 compare_stub.InitializeInterfaceDescriptor( |
1432 isolate, | |
1433 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); | 1413 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); |
1434 } | 1414 } |
1435 | 1415 |
1436 virtual InlineCacheState GetICState() { | 1416 virtual InlineCacheState GetICState() { |
1437 if (state_.Contains(GENERIC)) { | 1417 if (state_.Contains(GENERIC)) { |
1438 return MEGAMORPHIC; | 1418 return MEGAMORPHIC; |
1439 } else if (state_.Contains(MONOMORPHIC_MAP)) { | 1419 } else if (state_.Contains(MONOMORPHIC_MAP)) { |
1440 return MONOMORPHIC; | 1420 return MONOMORPHIC; |
1441 } else { | 1421 } else { |
1442 return PREMONOMORPHIC; | 1422 return PREMONOMORPHIC; |
1443 } | 1423 } |
1444 } | 1424 } |
1445 | 1425 |
1446 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } | 1426 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } |
1447 | 1427 |
1448 virtual Handle<Code> GenerateCode(Isolate* isolate); | 1428 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1449 | 1429 |
1450 virtual ExtraICState GetExtraICState() { | 1430 virtual ExtraICState GetExtraICState() { |
1451 return NilValueField::encode(nil_value_) | | 1431 return NilValueField::encode(nil_value_) | |
1452 TypesField::encode(state_.ToIntegral()); | 1432 TypesField::encode(state_.ToIntegral()); |
1453 } | 1433 } |
1454 | 1434 |
1455 void UpdateStatus(Handle<Object> object); | 1435 void UpdateStatus(Handle<Object> object); |
1456 | 1436 |
1457 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } | 1437 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); } |
1458 NilValue GetNilValue() const { return nil_value_; } | 1438 NilValue GetNilValue() const { return nil_value_; } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 | 1494 |
1515 void Generate(MacroAssembler* masm); | 1495 void Generate(MacroAssembler* masm); |
1516 | 1496 |
1517 // The version of this stub that doesn't save doubles is generated ahead of | 1497 // The version of this stub that doesn't save doubles is generated ahead of |
1518 // time, so it's OK to call it from other stubs that can't cope with GC during | 1498 // time, so it's OK to call it from other stubs that can't cope with GC during |
1519 // their code generation. On machines that always have gp registers (x64) we | 1499 // their code generation. On machines that always have gp registers (x64) we |
1520 // can generate both variants ahead of time. | 1500 // can generate both variants ahead of time. |
1521 static void GenerateAheadOfTime(Isolate* isolate); | 1501 static void GenerateAheadOfTime(Isolate* isolate); |
1522 | 1502 |
1523 protected: | 1503 protected: |
1524 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1504 virtual void VerifyPlatformFeatures() V8_OVERRIDE { |
1525 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1505 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
1526 }; | 1506 }; |
1527 | 1507 |
1528 private: | 1508 private: |
1529 // Number of pointers/values returned. | 1509 // Number of pointers/values returned. |
1530 Isolate* isolate_; | |
1531 const int result_size_; | 1510 const int result_size_; |
1532 SaveFPRegsMode save_doubles_; | 1511 SaveFPRegsMode save_doubles_; |
1533 | 1512 |
1534 Major MajorKey() { return CEntry; } | 1513 Major MajorKey() { return CEntry; } |
1535 int MinorKey(); | 1514 int MinorKey(); |
1536 | 1515 |
1537 bool NeedsImmovableCode(); | 1516 bool NeedsImmovableCode(); |
1538 }; | 1517 }; |
1539 | 1518 |
1540 | 1519 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 | 1589 |
1611 void Generate(MacroAssembler* masm); | 1590 void Generate(MacroAssembler* masm); |
1612 }; | 1591 }; |
1613 | 1592 |
1614 | 1593 |
1615 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { | 1594 class RegExpConstructResultStub V8_FINAL : public HydrogenCodeStub { |
1616 public: | 1595 public: |
1617 explicit RegExpConstructResultStub(Isolate* isolate) | 1596 explicit RegExpConstructResultStub(Isolate* isolate) |
1618 : HydrogenCodeStub(isolate) { } | 1597 : HydrogenCodeStub(isolate) { } |
1619 | 1598 |
1620 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1599 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1621 | 1600 |
1622 virtual void InitializeInterfaceDescriptor( | 1601 virtual void InitializeInterfaceDescriptor( |
1623 Isolate* isolate, | |
1624 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1602 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1625 | 1603 |
1626 virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; } | 1604 virtual Major MajorKey() V8_OVERRIDE { return RegExpConstructResult; } |
1627 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } | 1605 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } |
1628 | 1606 |
1629 static void InstallDescriptors(Isolate* isolate); | 1607 static void InstallDescriptors(Isolate* isolate); |
1630 | 1608 |
1631 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1609 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1632 static const int kLength = 0; | 1610 static const int kLength = 0; |
1633 static const int kIndex = 1; | 1611 static const int kIndex = 1; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 | 1862 |
1885 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); | 1863 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); |
1886 }; | 1864 }; |
1887 | 1865 |
1888 | 1866 |
1889 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { | 1867 class KeyedLoadDictionaryElementStub : public HydrogenCodeStub { |
1890 public: | 1868 public: |
1891 explicit KeyedLoadDictionaryElementStub(Isolate* isolate) | 1869 explicit KeyedLoadDictionaryElementStub(Isolate* isolate) |
1892 : HydrogenCodeStub(isolate) {} | 1870 : HydrogenCodeStub(isolate) {} |
1893 | 1871 |
1894 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 1872 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
1895 | 1873 |
1896 virtual void InitializeInterfaceDescriptor( | 1874 virtual void InitializeInterfaceDescriptor( |
1897 Isolate* isolate, | |
1898 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 1875 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
1899 | 1876 |
1900 private: | 1877 private: |
1901 Major MajorKey() { return KeyedLoadElement; } | 1878 Major MajorKey() { return KeyedLoadElement; } |
1902 int NotMissMinorKey() { return DICTIONARY_ELEMENTS; } | 1879 int NotMissMinorKey() { return DICTIONARY_ELEMENTS; } |
1903 | 1880 |
1904 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); | 1881 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); |
1905 }; | 1882 }; |
1906 | 1883 |
1907 | 1884 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 | 1933 |
1957 int offset() { | 1934 int offset() { |
1958 return OffsetBits::decode(bit_field_); | 1935 return OffsetBits::decode(bit_field_); |
1959 } | 1936 } |
1960 | 1937 |
1961 void Generate(MacroAssembler* masm); | 1938 void Generate(MacroAssembler* masm); |
1962 | 1939 |
1963 virtual bool SometimesSetsUpAFrame() { return false; } | 1940 virtual bool SometimesSetsUpAFrame() { return false; } |
1964 | 1941 |
1965 protected: | 1942 protected: |
1966 virtual void VerifyPlatformFeatures(Isolate* isolate) V8_OVERRIDE { | 1943 virtual void VerifyPlatformFeatures() V8_OVERRIDE { |
1967 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); | 1944 ASSERT(CpuFeatures::VerifyCrossCompiling(SSE2)); |
1968 } | 1945 } |
1969 | 1946 |
1970 private: | 1947 private: |
1971 static const int kBitsPerRegisterNumber = 6; | 1948 static const int kBitsPerRegisterNumber = 6; |
1972 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); | 1949 STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters); |
1973 class SourceRegisterBits: | 1950 class SourceRegisterBits: |
1974 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT | 1951 public BitField<int, 0, kBitsPerRegisterNumber> {}; // NOLINT |
1975 class DestinationRegisterBits: | 1952 class DestinationRegisterBits: |
1976 public BitField<int, kBitsPerRegisterNumber, | 1953 public BitField<int, kBitsPerRegisterNumber, |
(...skipping 27 matching lines...) Expand all Loading... |
2004 } | 1981 } |
2005 | 1982 |
2006 bool is_js_array() const { | 1983 bool is_js_array() const { |
2007 return IsJSArrayBits::decode(bit_field_); | 1984 return IsJSArrayBits::decode(bit_field_); |
2008 } | 1985 } |
2009 | 1986 |
2010 ElementsKind elements_kind() const { | 1987 ElementsKind elements_kind() const { |
2011 return ElementsKindBits::decode(bit_field_); | 1988 return ElementsKindBits::decode(bit_field_); |
2012 } | 1989 } |
2013 | 1990 |
2014 virtual Handle<Code> GenerateCode(Isolate* isolate); | 1991 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2015 | 1992 |
2016 virtual void InitializeInterfaceDescriptor( | 1993 virtual void InitializeInterfaceDescriptor( |
2017 Isolate* isolate, | 1994 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2018 CodeStubInterfaceDescriptor* descriptor); | |
2019 | 1995 |
2020 private: | 1996 private: |
2021 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1997 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2022 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 1998 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
2023 uint32_t bit_field_; | 1999 uint32_t bit_field_; |
2024 | 2000 |
2025 Major MajorKey() { return KeyedLoadElement; } | 2001 Major MajorKey() { return KeyedLoadElement; } |
2026 int NotMissMinorKey() { return bit_field_; } | 2002 int NotMissMinorKey() { return bit_field_; } |
2027 | 2003 |
2028 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); | 2004 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); |
(...skipping 17 matching lines...) Expand all Loading... |
2046 } | 2022 } |
2047 | 2023 |
2048 ElementsKind elements_kind() const { | 2024 ElementsKind elements_kind() const { |
2049 return ElementsKindBits::decode(bit_field_); | 2025 return ElementsKindBits::decode(bit_field_); |
2050 } | 2026 } |
2051 | 2027 |
2052 KeyedAccessStoreMode store_mode() const { | 2028 KeyedAccessStoreMode store_mode() const { |
2053 return StoreModeBits::decode(bit_field_); | 2029 return StoreModeBits::decode(bit_field_); |
2054 } | 2030 } |
2055 | 2031 |
2056 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2032 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2057 | 2033 |
2058 virtual void InitializeInterfaceDescriptor( | 2034 virtual void InitializeInterfaceDescriptor( |
2059 Isolate* isolate, | 2035 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2060 CodeStubInterfaceDescriptor* descriptor); | |
2061 | 2036 |
2062 private: | 2037 private: |
2063 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 2038 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
2064 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; | 2039 class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {}; |
2065 class IsJSArrayBits: public BitField<bool, 12, 1> {}; | 2040 class IsJSArrayBits: public BitField<bool, 12, 1> {}; |
2066 uint32_t bit_field_; | 2041 uint32_t bit_field_; |
2067 | 2042 |
2068 Major MajorKey() { return KeyedStoreElement; } | 2043 Major MajorKey() { return KeyedStoreElement; } |
2069 int NotMissMinorKey() { return bit_field_; } | 2044 int NotMissMinorKey() { return bit_field_; } |
2070 | 2045 |
(...skipping 17 matching lines...) Expand all Loading... |
2088 } | 2063 } |
2089 | 2064 |
2090 ElementsKind to_kind() const { | 2065 ElementsKind to_kind() const { |
2091 return ToKindBits::decode(bit_field_); | 2066 return ToKindBits::decode(bit_field_); |
2092 } | 2067 } |
2093 | 2068 |
2094 bool is_js_array() const { | 2069 bool is_js_array() const { |
2095 return IsJSArrayBits::decode(bit_field_); | 2070 return IsJSArrayBits::decode(bit_field_); |
2096 } | 2071 } |
2097 | 2072 |
2098 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2073 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2099 | 2074 |
2100 virtual void InitializeInterfaceDescriptor( | 2075 virtual void InitializeInterfaceDescriptor( |
2101 Isolate* isolate, | 2076 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2102 CodeStubInterfaceDescriptor* descriptor); | |
2103 | 2077 |
2104 private: | 2078 private: |
2105 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 2079 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
2106 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 2080 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
2107 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2081 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
2108 uint32_t bit_field_; | 2082 uint32_t bit_field_; |
2109 | 2083 |
2110 Major MajorKey() { return TransitionElementsKind; } | 2084 Major MajorKey() { return TransitionElementsKind; } |
2111 int NotMissMinorKey() { return bit_field_; } | 2085 int NotMissMinorKey() { return bit_field_; } |
2112 | 2086 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 | 2138 |
2165 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 2139 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
2166 public: | 2140 public: |
2167 ArrayNoArgumentConstructorStub( | 2141 ArrayNoArgumentConstructorStub( |
2168 Isolate* isolate, | 2142 Isolate* isolate, |
2169 ElementsKind kind, | 2143 ElementsKind kind, |
2170 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2144 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2171 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2145 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2172 } | 2146 } |
2173 | 2147 |
2174 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2148 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2175 | 2149 |
2176 virtual void InitializeInterfaceDescriptor( | 2150 virtual void InitializeInterfaceDescriptor( |
2177 Isolate* isolate, | 2151 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2178 CodeStubInterfaceDescriptor* descriptor); | |
2179 | 2152 |
2180 private: | 2153 private: |
2181 Major MajorKey() { return ArrayNoArgumentConstructor; } | 2154 Major MajorKey() { return ArrayNoArgumentConstructor; } |
2182 | 2155 |
2183 virtual void PrintName(StringStream* stream) { | 2156 virtual void PrintName(StringStream* stream) { |
2184 BasePrintName("ArrayNoArgumentConstructorStub", stream); | 2157 BasePrintName("ArrayNoArgumentConstructorStub", stream); |
2185 } | 2158 } |
2186 | 2159 |
2187 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 2160 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
2188 }; | 2161 }; |
2189 | 2162 |
2190 | 2163 |
2191 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 2164 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
2192 public: | 2165 public: |
2193 ArraySingleArgumentConstructorStub( | 2166 ArraySingleArgumentConstructorStub( |
2194 Isolate* isolate, | 2167 Isolate* isolate, |
2195 ElementsKind kind, | 2168 ElementsKind kind, |
2196 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2169 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2197 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2170 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2198 } | 2171 } |
2199 | 2172 |
2200 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2173 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2201 | 2174 |
2202 virtual void InitializeInterfaceDescriptor( | 2175 virtual void InitializeInterfaceDescriptor( |
2203 Isolate* isolate, | 2176 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2204 CodeStubInterfaceDescriptor* descriptor); | |
2205 | 2177 |
2206 private: | 2178 private: |
2207 Major MajorKey() { return ArraySingleArgumentConstructor; } | 2179 Major MajorKey() { return ArraySingleArgumentConstructor; } |
2208 | 2180 |
2209 virtual void PrintName(StringStream* stream) { | 2181 virtual void PrintName(StringStream* stream) { |
2210 BasePrintName("ArraySingleArgumentConstructorStub", stream); | 2182 BasePrintName("ArraySingleArgumentConstructorStub", stream); |
2211 } | 2183 } |
2212 | 2184 |
2213 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 2185 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
2214 }; | 2186 }; |
2215 | 2187 |
2216 | 2188 |
2217 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 2189 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
2218 public: | 2190 public: |
2219 ArrayNArgumentsConstructorStub( | 2191 ArrayNArgumentsConstructorStub( |
2220 Isolate* isolate, | 2192 Isolate* isolate, |
2221 ElementsKind kind, | 2193 ElementsKind kind, |
2222 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) | 2194 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
2223 : ArrayConstructorStubBase(isolate, kind, override_mode) { | 2195 : ArrayConstructorStubBase(isolate, kind, override_mode) { |
2224 } | 2196 } |
2225 | 2197 |
2226 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2198 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2227 | 2199 |
2228 virtual void InitializeInterfaceDescriptor( | 2200 virtual void InitializeInterfaceDescriptor( |
2229 Isolate* isolate, | 2201 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2230 CodeStubInterfaceDescriptor* descriptor); | |
2231 | 2202 |
2232 private: | 2203 private: |
2233 Major MajorKey() { return ArrayNArgumentsConstructor; } | 2204 Major MajorKey() { return ArrayNArgumentsConstructor; } |
2234 | 2205 |
2235 virtual void PrintName(StringStream* stream) { | 2206 virtual void PrintName(StringStream* stream) { |
2236 BasePrintName("ArrayNArgumentsConstructorStub", stream); | 2207 BasePrintName("ArrayNArgumentsConstructorStub", stream); |
2237 } | 2208 } |
2238 | 2209 |
2239 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2210 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
2240 }; | 2211 }; |
(...skipping 23 matching lines...) Expand all Loading... |
2264 }; | 2235 }; |
2265 | 2236 |
2266 | 2237 |
2267 class InternalArrayNoArgumentConstructorStub : public | 2238 class InternalArrayNoArgumentConstructorStub : public |
2268 InternalArrayConstructorStubBase { | 2239 InternalArrayConstructorStubBase { |
2269 public: | 2240 public: |
2270 InternalArrayNoArgumentConstructorStub(Isolate* isolate, | 2241 InternalArrayNoArgumentConstructorStub(Isolate* isolate, |
2271 ElementsKind kind) | 2242 ElementsKind kind) |
2272 : InternalArrayConstructorStubBase(isolate, kind) { } | 2243 : InternalArrayConstructorStubBase(isolate, kind) { } |
2273 | 2244 |
2274 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2245 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2275 | 2246 |
2276 virtual void InitializeInterfaceDescriptor( | 2247 virtual void InitializeInterfaceDescriptor( |
2277 Isolate* isolate, | 2248 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2278 CodeStubInterfaceDescriptor* descriptor); | |
2279 | 2249 |
2280 private: | 2250 private: |
2281 Major MajorKey() { return InternalArrayNoArgumentConstructor; } | 2251 Major MajorKey() { return InternalArrayNoArgumentConstructor; } |
2282 | 2252 |
2283 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); | 2253 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); |
2284 }; | 2254 }; |
2285 | 2255 |
2286 | 2256 |
2287 class InternalArraySingleArgumentConstructorStub : public | 2257 class InternalArraySingleArgumentConstructorStub : public |
2288 InternalArrayConstructorStubBase { | 2258 InternalArrayConstructorStubBase { |
2289 public: | 2259 public: |
2290 InternalArraySingleArgumentConstructorStub(Isolate* isolate, | 2260 InternalArraySingleArgumentConstructorStub(Isolate* isolate, |
2291 ElementsKind kind) | 2261 ElementsKind kind) |
2292 : InternalArrayConstructorStubBase(isolate, kind) { } | 2262 : InternalArrayConstructorStubBase(isolate, kind) { } |
2293 | 2263 |
2294 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2264 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2295 | 2265 |
2296 virtual void InitializeInterfaceDescriptor( | 2266 virtual void InitializeInterfaceDescriptor( |
2297 Isolate* isolate, | 2267 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2298 CodeStubInterfaceDescriptor* descriptor); | |
2299 | 2268 |
2300 private: | 2269 private: |
2301 Major MajorKey() { return InternalArraySingleArgumentConstructor; } | 2270 Major MajorKey() { return InternalArraySingleArgumentConstructor; } |
2302 | 2271 |
2303 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); | 2272 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); |
2304 }; | 2273 }; |
2305 | 2274 |
2306 | 2275 |
2307 class InternalArrayNArgumentsConstructorStub : public | 2276 class InternalArrayNArgumentsConstructorStub : public |
2308 InternalArrayConstructorStubBase { | 2277 InternalArrayConstructorStubBase { |
2309 public: | 2278 public: |
2310 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) | 2279 InternalArrayNArgumentsConstructorStub(Isolate* isolate, ElementsKind kind) |
2311 : InternalArrayConstructorStubBase(isolate, kind) { } | 2280 : InternalArrayConstructorStubBase(isolate, kind) { } |
2312 | 2281 |
2313 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2282 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2314 | 2283 |
2315 virtual void InitializeInterfaceDescriptor( | 2284 virtual void InitializeInterfaceDescriptor( |
2316 Isolate* isolate, | 2285 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2317 CodeStubInterfaceDescriptor* descriptor); | |
2318 | 2286 |
2319 private: | 2287 private: |
2320 Major MajorKey() { return InternalArrayNArgumentsConstructor; } | 2288 Major MajorKey() { return InternalArrayNArgumentsConstructor; } |
2321 | 2289 |
2322 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); | 2290 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
2323 }; | 2291 }; |
2324 | 2292 |
2325 | 2293 |
2326 class KeyedStoreElementStub : public PlatformCodeStub { | 2294 class KeyedStoreElementStub : public PlatformCodeStub { |
2327 public: | 2295 public: |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 }; | 2362 }; |
2395 | 2363 |
2396 ToBooleanStub(Isolate* isolate, Types types = Types()) | 2364 ToBooleanStub(Isolate* isolate, Types types = Types()) |
2397 : HydrogenCodeStub(isolate), types_(types) { } | 2365 : HydrogenCodeStub(isolate), types_(types) { } |
2398 ToBooleanStub(Isolate* isolate, ExtraICState state) | 2366 ToBooleanStub(Isolate* isolate, ExtraICState state) |
2399 : HydrogenCodeStub(isolate), types_(static_cast<byte>(state)) { } | 2367 : HydrogenCodeStub(isolate), types_(static_cast<byte>(state)) { } |
2400 | 2368 |
2401 bool UpdateStatus(Handle<Object> object); | 2369 bool UpdateStatus(Handle<Object> object); |
2402 Types GetTypes() { return types_; } | 2370 Types GetTypes() { return types_; } |
2403 | 2371 |
2404 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2372 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2405 virtual void InitializeInterfaceDescriptor( | 2373 virtual void InitializeInterfaceDescriptor( |
2406 Isolate* isolate, | 2374 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2407 CodeStubInterfaceDescriptor* descriptor); | |
2408 | 2375 |
2409 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } | 2376 virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } |
2410 virtual void PrintState(StringStream* stream); | 2377 virtual void PrintState(StringStream* stream); |
2411 | 2378 |
2412 virtual bool SometimesSetsUpAFrame() { return false; } | 2379 virtual bool SometimesSetsUpAFrame() { return false; } |
2413 | 2380 |
2414 static void InstallDescriptors(Isolate* isolate) { | 2381 static void InstallDescriptors(Isolate* isolate) { |
2415 ToBooleanStub stub(isolate); | 2382 ToBooleanStub stub(isolate); |
2416 stub.InitializeInterfaceDescriptor( | 2383 stub.InitializeInterfaceDescriptor( |
2417 isolate, | |
2418 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); | 2384 isolate->code_stub_interface_descriptor(CodeStub::ToBoolean)); |
2419 } | 2385 } |
2420 | 2386 |
2421 static Handle<Code> GetUninitialized(Isolate* isolate) { | 2387 static Handle<Code> GetUninitialized(Isolate* isolate) { |
2422 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(isolate); | 2388 return ToBooleanStub(isolate, UNINITIALIZED).GetCode(); |
2423 } | 2389 } |
2424 | 2390 |
2425 virtual ExtraICState GetExtraICState() { | 2391 virtual ExtraICState GetExtraICState() { |
2426 return types_.ToIntegral(); | 2392 return types_.ToIntegral(); |
2427 } | 2393 } |
2428 | 2394 |
2429 virtual InlineCacheState GetICState() { | 2395 virtual InlineCacheState GetICState() { |
2430 if (types_.IsEmpty()) { | 2396 if (types_.IsEmpty()) { |
2431 return ::v8::internal::UNINITIALIZED; | 2397 return ::v8::internal::UNINITIALIZED; |
2432 } else { | 2398 } else { |
(...skipping 23 matching lines...) Expand all Loading... |
2456 from_kind_(from_kind), | 2422 from_kind_(from_kind), |
2457 to_kind_(to_kind), | 2423 to_kind_(to_kind), |
2458 is_jsarray_(is_jsarray), | 2424 is_jsarray_(is_jsarray), |
2459 store_mode_(store_mode) {} | 2425 store_mode_(store_mode) {} |
2460 | 2426 |
2461 ElementsKind from_kind() const { return from_kind_; } | 2427 ElementsKind from_kind() const { return from_kind_; } |
2462 ElementsKind to_kind() const { return to_kind_; } | 2428 ElementsKind to_kind() const { return to_kind_; } |
2463 bool is_jsarray() const { return is_jsarray_; } | 2429 bool is_jsarray() const { return is_jsarray_; } |
2464 KeyedAccessStoreMode store_mode() const { return store_mode_; } | 2430 KeyedAccessStoreMode store_mode() const { return store_mode_; } |
2465 | 2431 |
2466 virtual Handle<Code> GenerateCode(Isolate* isolate); | 2432 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
2467 | 2433 |
2468 void InitializeInterfaceDescriptor( | 2434 virtual void InitializeInterfaceDescriptor( |
2469 Isolate* isolate, | 2435 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
2470 CodeStubInterfaceDescriptor* descriptor); | |
2471 | 2436 |
2472 private: | 2437 private: |
2473 class FromBits: public BitField<ElementsKind, 0, 8> {}; | 2438 class FromBits: public BitField<ElementsKind, 0, 8> {}; |
2474 class ToBits: public BitField<ElementsKind, 8, 8> {}; | 2439 class ToBits: public BitField<ElementsKind, 8, 8> {}; |
2475 class IsJSArrayBits: public BitField<bool, 16, 1> {}; | 2440 class IsJSArrayBits: public BitField<bool, 16, 1> {}; |
2476 class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; | 2441 class StoreModeBits: public BitField<KeyedAccessStoreMode, 17, 4> {}; |
2477 | 2442 |
2478 Major MajorKey() { return ElementsTransitionAndStore; } | 2443 Major MajorKey() { return ElementsTransitionAndStore; } |
2479 int NotMissMinorKey() { | 2444 int NotMissMinorKey() { |
2480 return FromBits::encode(from_kind_) | | 2445 return FromBits::encode(from_kind_) | |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 | 2529 |
2565 | 2530 |
2566 class CallDescriptors { | 2531 class CallDescriptors { |
2567 public: | 2532 public: |
2568 static void InitializeForIsolate(Isolate* isolate); | 2533 static void InitializeForIsolate(Isolate* isolate); |
2569 }; | 2534 }; |
2570 | 2535 |
2571 } } // namespace v8::internal | 2536 } } // namespace v8::internal |
2572 | 2537 |
2573 #endif // V8_CODE_STUBS_H_ | 2538 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |