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

Side by Side Diff: src/code-stubs.h

Issue 10701054: Enable stub generation using Hydrogen/Lithium (again) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years 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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // GC. This means that we must be statically sure that no GC can occur while 155 // GC. This means that we must be statically sure that no GC can occur while
156 // they are running. If that is the case they should override this to return 156 // they are running. If that is the case they should override this to return
157 // true, which will cause an assertion if we try to call something that can 157 // true, which will cause an assertion if we try to call something that can
158 // GC or if we try to put a stack frame on top of the junk, which would not 158 // GC or if we try to put a stack frame on top of the junk, which would not
159 // result in a traversable stack. 159 // result in a traversable stack.
160 virtual bool SometimesSetsUpAFrame() { return true; } 160 virtual bool SometimesSetsUpAFrame() { return true; }
161 161
162 // Lookup the code in the (possibly custom) cache. 162 // Lookup the code in the (possibly custom) cache.
163 bool FindCodeInCache(Code** code_out, Isolate* isolate); 163 bool FindCodeInCache(Code** code_out, Isolate* isolate);
164 164
165 // Returns information for computing the number key.
166 virtual Major MajorKey() = 0;
167 virtual int MinorKey() = 0;
168
165 protected: 169 protected:
166 static bool CanUseFPRegisters(); 170 static bool CanUseFPRegisters();
167 171
168 private: 172 private:
169 // Nonvirtual wrapper around the stub-specific Generate function. Call 173 friend class PlatformCodeStub;
Jakob Kummerow 2012/11/28 16:28:22 Since both of these friends are also subclasses, w
danno 2012/11/30 16:23:24 Done.
170 // this function to set up the macro assembler and generate the code. 174 friend class HydrogenCodeStub;
171 void GenerateCode(MacroAssembler* masm);
172 175
173 // Generates the assembler code for the stub. 176 // Generates the assembler code for the stub.
174 virtual void Generate(MacroAssembler* masm) = 0; 177 virtual Handle<Code> GenerateCode() = 0;
175 178
176 // Perform bookkeeping required after code generation when stub code is 179 // Perform bookkeeping required after code generation when stub code is
177 // initially generated. 180 // initially generated.
178 void RecordCodeGeneration(Code* code, MacroAssembler* masm); 181 void RecordCodeGeneration(Code* code, Isolate* isolate);
179 182
180 // Finish the code object after it has been generated. 183 // Finish the code object after it has been generated.
181 virtual void FinishCode(Handle<Code> code) { } 184 virtual void FinishCode(Handle<Code> code) { }
182 185
183 // Activate newly generated stub. Is called after 186 // Activate newly generated stub. Is called after
184 // registering stub in the stub cache. 187 // registering stub in the stub cache.
185 virtual void Activate(Code* code) { } 188 virtual void Activate(Code* code) { }
186 189
187 // Returns information for computing the number key.
188 virtual Major MajorKey() = 0;
189 virtual int MinorKey() = 0;
190
191 // BinaryOpStub needs to override this. 190 // BinaryOpStub needs to override this.
192 virtual int GetCodeKind(); 191 virtual int GetCodeKind();
193 192
194 // BinaryOpStub needs to override this. 193 // BinaryOpStub needs to override this.
195 virtual InlineCacheState GetICState() { 194 virtual InlineCacheState GetICState() {
196 return UNINITIALIZED; 195 return UNINITIALIZED;
197 } 196 }
198 197
199 // Add the code to a specialized cache, specific to an individual 198 // Add the code to a specialized cache, specific to an individual
200 // stub type. Please note, this method must add the code object to a 199 // stub type. Please note, this method must add the code object to a
(...skipping 24 matching lines...) Expand all
225 } 224 }
226 225
227 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; 226 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {};
228 class MinorKeyBits: public BitField<uint32_t, 227 class MinorKeyBits: public BitField<uint32_t,
229 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT 228 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT
230 229
231 friend class BreakPointIterator; 230 friend class BreakPointIterator;
232 }; 231 };
233 232
234 233
234 class PlatformCodeStub : public CodeStub {
235 public:
236 // Retrieve the code for the stub. Generate the code if needed.
237 virtual Handle<Code> GenerateCode();
238
239 virtual int GetCodeKind() { return Code::STUB; }
240
241 protected:
242 // Generates the assembler code for the stub.
243 virtual void Generate(MacroAssembler* masm) = 0;
244 };
245
246
247 struct CodeStubInterfaceDescriptor {
Jakob Kummerow 2012/11/28 16:28:22 Nice!
danno 2012/11/30 16:23:24 I like it too! On 2012/11/28 16:28:22, Jakob wrote
248 int number_of_register_params;
249 Register* register_params;
250 Handle<Code> deoptimization_handler;
251 };
252
253
254 class HGraph;
255 class Register;
256 class HydrogenCodeStub : public CodeStub {
257 public:
258 // Retrieve the code for the stub. Generate the code if needed.
259 virtual Handle<Code> GenerateCode() = 0;
260
261 virtual int GetCodeKind() { return Code::COMPILED_STUB; }
262
263 virtual CodeStubInterfaceDescriptor* GetInterfaceDescriptor(
264 Isolate* isolate) = 0;
265
266 protected:
267 Handle<Code> CodeFromGraph(HGraph* graph);
268 };
269
270
235 // Helper interface to prepare to/restore after making runtime calls. 271 // Helper interface to prepare to/restore after making runtime calls.
236 class RuntimeCallHelper { 272 class RuntimeCallHelper {
237 public: 273 public:
238 virtual ~RuntimeCallHelper() {} 274 virtual ~RuntimeCallHelper() {}
239 275
240 virtual void BeforeCall(MacroAssembler* masm) const = 0; 276 virtual void BeforeCall(MacroAssembler* masm) const = 0;
241 277
242 virtual void AfterCall(MacroAssembler* masm) const = 0; 278 virtual void AfterCall(MacroAssembler* masm) const = 0;
243 279
244 protected: 280 protected:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 class NopRuntimeCallHelper : public RuntimeCallHelper { 318 class NopRuntimeCallHelper : public RuntimeCallHelper {
283 public: 319 public:
284 NopRuntimeCallHelper() {} 320 NopRuntimeCallHelper() {}
285 321
286 virtual void BeforeCall(MacroAssembler* masm) const {} 322 virtual void BeforeCall(MacroAssembler* masm) const {}
287 323
288 virtual void AfterCall(MacroAssembler* masm) const {} 324 virtual void AfterCall(MacroAssembler* masm) const {}
289 }; 325 };
290 326
291 327
292 class StackCheckStub : public CodeStub { 328 class StackCheckStub : public PlatformCodeStub {
293 public: 329 public:
294 StackCheckStub() { } 330 StackCheckStub() { }
295 331
296 void Generate(MacroAssembler* masm); 332 void Generate(MacroAssembler* masm);
297 333
298 private: 334 private:
299 Major MajorKey() { return StackCheck; } 335 Major MajorKey() { return StackCheck; }
300 int MinorKey() { return 0; } 336 int MinorKey() { return 0; }
301 }; 337 };
302 338
303 339
304 class InterruptStub : public CodeStub { 340 class InterruptStub : public PlatformCodeStub {
305 public: 341 public:
306 InterruptStub() { } 342 InterruptStub() { }
307 343
308 void Generate(MacroAssembler* masm); 344 void Generate(MacroAssembler* masm);
309 345
310 private: 346 private:
311 Major MajorKey() { return Interrupt; } 347 Major MajorKey() { return Interrupt; }
312 int MinorKey() { return 0; } 348 int MinorKey() { return 0; }
313 }; 349 };
314 350
315 351
316 class ToNumberStub: public CodeStub { 352 class ToNumberStub: public PlatformCodeStub {
317 public: 353 public:
318 ToNumberStub() { } 354 ToNumberStub() { }
319 355
320 void Generate(MacroAssembler* masm); 356 void Generate(MacroAssembler* masm);
321 357
322 private: 358 private:
323 Major MajorKey() { return ToNumber; } 359 Major MajorKey() { return ToNumber; }
324 int MinorKey() { return 0; } 360 int MinorKey() { return 0; }
325 }; 361 };
326 362
327 363
328 class FastNewClosureStub : public CodeStub { 364 class FastNewClosureStub : public PlatformCodeStub {
329 public: 365 public:
330 explicit FastNewClosureStub(LanguageMode language_mode) 366 explicit FastNewClosureStub(LanguageMode language_mode)
331 : language_mode_(language_mode) { } 367 : language_mode_(language_mode) { }
332 368
333 void Generate(MacroAssembler* masm); 369 void Generate(MacroAssembler* masm);
334 370
335 private: 371 private:
336 Major MajorKey() { return FastNewClosure; } 372 Major MajorKey() { return FastNewClosure; }
337 int MinorKey() { return language_mode_ == CLASSIC_MODE 373 int MinorKey() { return language_mode_ == CLASSIC_MODE
338 ? kNonStrictMode : kStrictMode; } 374 ? kNonStrictMode : kStrictMode; }
339 375
340 LanguageMode language_mode_; 376 LanguageMode language_mode_;
341 }; 377 };
342 378
343 379
344 class FastNewContextStub : public CodeStub { 380 class FastNewContextStub : public PlatformCodeStub {
345 public: 381 public:
346 static const int kMaximumSlots = 64; 382 static const int kMaximumSlots = 64;
347 383
348 explicit FastNewContextStub(int slots) : slots_(slots) { 384 explicit FastNewContextStub(int slots) : slots_(slots) {
349 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); 385 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots);
350 } 386 }
351 387
352 void Generate(MacroAssembler* masm); 388 void Generate(MacroAssembler* masm);
353 389
354 private: 390 private:
355 int slots_; 391 int slots_;
356 392
357 Major MajorKey() { return FastNewContext; } 393 Major MajorKey() { return FastNewContext; }
358 int MinorKey() { return slots_; } 394 int MinorKey() { return slots_; }
359 }; 395 };
360 396
361 397
362 class FastNewBlockContextStub : public CodeStub { 398 class FastNewBlockContextStub : public PlatformCodeStub {
363 public: 399 public:
364 static const int kMaximumSlots = 64; 400 static const int kMaximumSlots = 64;
365 401
366 explicit FastNewBlockContextStub(int slots) : slots_(slots) { 402 explicit FastNewBlockContextStub(int slots) : slots_(slots) {
367 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); 403 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots);
368 } 404 }
369 405
370 void Generate(MacroAssembler* masm); 406 void Generate(MacroAssembler* masm);
371 407
372 private: 408 private:
373 int slots_; 409 int slots_;
374 410
375 Major MajorKey() { return FastNewBlockContext; } 411 Major MajorKey() { return FastNewBlockContext; }
376 int MinorKey() { return slots_; } 412 int MinorKey() { return slots_; }
377 }; 413 };
378 414
379 415
380 class FastCloneShallowArrayStub : public CodeStub { 416 class FastCloneShallowArrayStub : public PlatformCodeStub {
381 public: 417 public:
382 // Maximum length of copied elements array. 418 // Maximum length of copied elements array.
383 static const int kMaximumClonedLength = 8; 419 static const int kMaximumClonedLength = 8;
384 420
385 enum Mode { 421 enum Mode {
386 CLONE_ELEMENTS, 422 CLONE_ELEMENTS,
387 CLONE_DOUBLE_ELEMENTS, 423 CLONE_DOUBLE_ELEMENTS,
388 COPY_ON_WRITE_ELEMENTS, 424 COPY_ON_WRITE_ELEMENTS,
389 CLONE_ANY_ELEMENTS 425 CLONE_ANY_ELEMENTS
390 }; 426 };
(...skipping 12 matching lines...) Expand all
403 int length_; 439 int length_;
404 440
405 Major MajorKey() { return FastCloneShallowArray; } 441 Major MajorKey() { return FastCloneShallowArray; }
406 int MinorKey() { 442 int MinorKey() {
407 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); 443 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3);
408 return length_ * 4 + mode_; 444 return length_ * 4 + mode_;
409 } 445 }
410 }; 446 };
411 447
412 448
413 class FastCloneShallowObjectStub : public CodeStub { 449 class FastCloneShallowObjectStub : public PlatformCodeStub {
414 public: 450 public:
415 // Maximum number of properties in copied object. 451 // Maximum number of properties in copied object.
416 static const int kMaximumClonedProperties = 6; 452 static const int kMaximumClonedProperties = 6;
417 453
418 explicit FastCloneShallowObjectStub(int length) : length_(length) { 454 explicit FastCloneShallowObjectStub(int length) : length_(length) {
419 ASSERT_GE(length_, 0); 455 ASSERT_GE(length_, 0);
420 ASSERT_LE(length_, kMaximumClonedProperties); 456 ASSERT_LE(length_, kMaximumClonedProperties);
421 } 457 }
422 458
423 void Generate(MacroAssembler* masm); 459 void Generate(MacroAssembler* masm);
424 460
425 private: 461 private:
426 int length_; 462 int length_;
427 463
428 Major MajorKey() { return FastCloneShallowObject; } 464 Major MajorKey() { return FastCloneShallowObject; }
429 int MinorKey() { return length_; } 465 int MinorKey() { return length_; }
430 }; 466 };
431 467
432 468
433 class InstanceofStub: public CodeStub { 469 class InstanceofStub: public PlatformCodeStub {
434 public: 470 public:
435 enum Flags { 471 enum Flags {
436 kNoFlags = 0, 472 kNoFlags = 0,
437 kArgsInRegisters = 1 << 0, 473 kArgsInRegisters = 1 << 0,
438 kCallSiteInlineCheck = 1 << 1, 474 kCallSiteInlineCheck = 1 << 1,
439 kReturnTrueFalseObject = 1 << 2 475 kReturnTrueFalseObject = 1 << 2
440 }; 476 };
441 477
442 explicit InstanceofStub(Flags flags) : flags_(flags) { } 478 explicit InstanceofStub(Flags flags) : flags_(flags) { }
443 479
(...skipping 17 matching lines...) Expand all
461 bool ReturnTrueFalseObject() const { 497 bool ReturnTrueFalseObject() const {
462 return (flags_ & kReturnTrueFalseObject) != 0; 498 return (flags_ & kReturnTrueFalseObject) != 0;
463 } 499 }
464 500
465 virtual void PrintName(StringStream* stream); 501 virtual void PrintName(StringStream* stream);
466 502
467 Flags flags_; 503 Flags flags_;
468 }; 504 };
469 505
470 506
471 class MathPowStub: public CodeStub { 507 class MathPowStub: public PlatformCodeStub {
472 public: 508 public:
473 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; 509 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK};
474 510
475 explicit MathPowStub(ExponentType exponent_type) 511 explicit MathPowStub(ExponentType exponent_type)
476 : exponent_type_(exponent_type) { } 512 : exponent_type_(exponent_type) { }
477 virtual void Generate(MacroAssembler* masm); 513 virtual void Generate(MacroAssembler* masm);
478 514
479 private: 515 private:
480 virtual CodeStub::Major MajorKey() { return MathPow; } 516 virtual CodeStub::Major MajorKey() { return MathPow; }
481 virtual int MinorKey() { return exponent_type_; } 517 virtual int MinorKey() { return exponent_type_; }
482 518
483 ExponentType exponent_type_; 519 ExponentType exponent_type_;
484 }; 520 };
485 521
486 522
487 class BinaryOpStub: public CodeStub { 523 class BinaryOpStub: public PlatformCodeStub {
488 public: 524 public:
489 BinaryOpStub(Token::Value op, OverwriteMode mode) 525 BinaryOpStub(Token::Value op, OverwriteMode mode)
490 : op_(op), 526 : op_(op),
491 mode_(mode), 527 mode_(mode),
492 platform_specific_bit_(false), 528 platform_specific_bit_(false),
493 left_type_(BinaryOpIC::UNINITIALIZED), 529 left_type_(BinaryOpIC::UNINITIALIZED),
494 right_type_(BinaryOpIC::UNINITIALIZED), 530 right_type_(BinaryOpIC::UNINITIALIZED),
495 result_type_(BinaryOpIC::UNINITIALIZED) { 531 result_type_(BinaryOpIC::UNINITIALIZED) {
496 Initialize(); 532 Initialize();
497 ASSERT(OpBits::is_valid(Token::NUM_TOKENS)); 533 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 } 629 }
594 630
595 virtual void FinishCode(Handle<Code> code) { 631 virtual void FinishCode(Handle<Code> code) {
596 code->set_stub_info(MinorKey()); 632 code->set_stub_info(MinorKey());
597 } 633 }
598 634
599 friend class CodeGenerator; 635 friend class CodeGenerator;
600 }; 636 };
601 637
602 638
603 class ICCompareStub: public CodeStub { 639 class ICCompareStub: public PlatformCodeStub {
604 public: 640 public:
605 ICCompareStub(Token::Value op, 641 ICCompareStub(Token::Value op,
606 CompareIC::State left, 642 CompareIC::State left,
607 CompareIC::State right, 643 CompareIC::State right,
608 CompareIC::State handler) 644 CompareIC::State handler)
609 : op_(op), 645 : op_(op),
610 left_(left), 646 left_(left),
611 right_(right), 647 right_(right),
612 state_(handler) { 648 state_(handler) {
613 ASSERT(Token::IsCompareOp(op)); 649 ASSERT(Token::IsCompareOp(op));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECTS; } 695 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECTS; }
660 696
661 Token::Value op_; 697 Token::Value op_;
662 CompareIC::State left_; 698 CompareIC::State left_;
663 CompareIC::State right_; 699 CompareIC::State right_;
664 CompareIC::State state_; 700 CompareIC::State state_;
665 Handle<Map> known_map_; 701 Handle<Map> known_map_;
666 }; 702 };
667 703
668 704
669 class CEntryStub : public CodeStub { 705 class CEntryStub : public PlatformCodeStub {
670 public: 706 public:
671 explicit CEntryStub(int result_size, 707 explicit CEntryStub(int result_size,
672 SaveFPRegsMode save_doubles = kDontSaveFPRegs) 708 SaveFPRegsMode save_doubles = kDontSaveFPRegs)
673 : result_size_(result_size), save_doubles_(save_doubles) { } 709 : result_size_(result_size), save_doubles_(save_doubles) { }
674 710
675 void Generate(MacroAssembler* masm); 711 void Generate(MacroAssembler* masm);
676 712
677 // The version of this stub that doesn't save doubles is generated ahead of 713 // The version of this stub that doesn't save doubles is generated ahead of
678 // time, so it's OK to call it from other stubs that can't cope with GC during 714 // time, so it's OK to call it from other stubs that can't cope with GC during
679 // their code generation. On machines that always have gp registers (x64) we 715 // their code generation. On machines that always have gp registers (x64) we
(...skipping 13 matching lines...) Expand all
693 const int result_size_; 729 const int result_size_;
694 SaveFPRegsMode save_doubles_; 730 SaveFPRegsMode save_doubles_;
695 731
696 Major MajorKey() { return CEntry; } 732 Major MajorKey() { return CEntry; }
697 int MinorKey(); 733 int MinorKey();
698 734
699 bool NeedsImmovableCode(); 735 bool NeedsImmovableCode();
700 }; 736 };
701 737
702 738
703 class JSEntryStub : public CodeStub { 739 class JSEntryStub : public PlatformCodeStub {
704 public: 740 public:
705 JSEntryStub() { } 741 JSEntryStub() { }
706 742
707 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } 743 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); }
708 744
709 protected: 745 protected:
710 void GenerateBody(MacroAssembler* masm, bool is_construct); 746 void GenerateBody(MacroAssembler* masm, bool is_construct);
711 747
712 private: 748 private:
713 Major MajorKey() { return JSEntry; } 749 Major MajorKey() { return JSEntry; }
(...skipping 13 matching lines...) Expand all
727 763
728 private: 764 private:
729 int MinorKey() { return 1; } 765 int MinorKey() { return 1; }
730 766
731 virtual void PrintName(StringStream* stream) { 767 virtual void PrintName(StringStream* stream) {
732 stream->Add("JSConstructEntryStub"); 768 stream->Add("JSConstructEntryStub");
733 } 769 }
734 }; 770 };
735 771
736 772
737 class ArgumentsAccessStub: public CodeStub { 773 class ArgumentsAccessStub: public PlatformCodeStub {
738 public: 774 public:
739 enum Type { 775 enum Type {
740 READ_ELEMENT, 776 READ_ELEMENT,
741 NEW_NON_STRICT_FAST, 777 NEW_NON_STRICT_FAST,
742 NEW_NON_STRICT_SLOW, 778 NEW_NON_STRICT_SLOW,
743 NEW_STRICT 779 NEW_STRICT
744 }; 780 };
745 781
746 explicit ArgumentsAccessStub(Type type) : type_(type) { } 782 explicit ArgumentsAccessStub(Type type) : type_(type) { }
747 783
748 private: 784 private:
749 Type type_; 785 Type type_;
750 786
751 Major MajorKey() { return ArgumentsAccess; } 787 Major MajorKey() { return ArgumentsAccess; }
752 int MinorKey() { return type_; } 788 int MinorKey() { return type_; }
753 789
754 void Generate(MacroAssembler* masm); 790 void Generate(MacroAssembler* masm);
755 void GenerateReadElement(MacroAssembler* masm); 791 void GenerateReadElement(MacroAssembler* masm);
756 void GenerateNewStrict(MacroAssembler* masm); 792 void GenerateNewStrict(MacroAssembler* masm);
757 void GenerateNewNonStrictFast(MacroAssembler* masm); 793 void GenerateNewNonStrictFast(MacroAssembler* masm);
758 void GenerateNewNonStrictSlow(MacroAssembler* masm); 794 void GenerateNewNonStrictSlow(MacroAssembler* masm);
759 795
760 virtual void PrintName(StringStream* stream); 796 virtual void PrintName(StringStream* stream);
761 }; 797 };
762 798
763 799
764 class RegExpExecStub: public CodeStub { 800 class RegExpExecStub: public PlatformCodeStub {
765 public: 801 public:
766 RegExpExecStub() { } 802 RegExpExecStub() { }
767 803
768 private: 804 private:
769 Major MajorKey() { return RegExpExec; } 805 Major MajorKey() { return RegExpExec; }
770 int MinorKey() { return 0; } 806 int MinorKey() { return 0; }
771 807
772 void Generate(MacroAssembler* masm); 808 void Generate(MacroAssembler* masm);
773 }; 809 };
774 810
775 811
776 class RegExpConstructResultStub: public CodeStub { 812 class RegExpConstructResultStub: public PlatformCodeStub {
777 public: 813 public:
778 RegExpConstructResultStub() { } 814 RegExpConstructResultStub() { }
779 815
780 private: 816 private:
781 Major MajorKey() { return RegExpConstructResult; } 817 Major MajorKey() { return RegExpConstructResult; }
782 int MinorKey() { return 0; } 818 int MinorKey() { return 0; }
783 819
784 void Generate(MacroAssembler* masm); 820 void Generate(MacroAssembler* masm);
785 }; 821 };
786 822
787 823
788 class CallFunctionStub: public CodeStub { 824 class CallFunctionStub: public PlatformCodeStub {
789 public: 825 public:
790 CallFunctionStub(int argc, CallFunctionFlags flags) 826 CallFunctionStub(int argc, CallFunctionFlags flags)
791 : argc_(argc), flags_(flags) { } 827 : argc_(argc), flags_(flags) { }
792 828
793 void Generate(MacroAssembler* masm); 829 void Generate(MacroAssembler* masm);
794 830
795 virtual void FinishCode(Handle<Code> code) { 831 virtual void FinishCode(Handle<Code> code) {
796 code->set_has_function_cache(RecordCallTarget()); 832 code->set_has_function_cache(RecordCallTarget());
797 } 833 }
798 834
(...skipping 20 matching lines...) Expand all
819 bool ReceiverMightBeImplicit() { 855 bool ReceiverMightBeImplicit() {
820 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; 856 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0;
821 } 857 }
822 858
823 bool RecordCallTarget() { 859 bool RecordCallTarget() {
824 return (flags_ & RECORD_CALL_TARGET) != 0; 860 return (flags_ & RECORD_CALL_TARGET) != 0;
825 } 861 }
826 }; 862 };
827 863
828 864
829 class CallConstructStub: public CodeStub { 865 class CallConstructStub: public PlatformCodeStub {
830 public: 866 public:
831 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} 867 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {}
832 868
833 void Generate(MacroAssembler* masm); 869 void Generate(MacroAssembler* masm);
834 870
835 virtual void FinishCode(Handle<Code> code) { 871 virtual void FinishCode(Handle<Code> code) {
836 code->set_has_function_cache(RecordCallTarget()); 872 code->set_has_function_cache(RecordCallTarget());
837 } 873 }
838 874
839 private: 875 private:
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1046 }
1011 1047
1012 private: 1048 private:
1013 MacroAssembler* masm_; 1049 MacroAssembler* masm_;
1014 bool previous_allow_; 1050 bool previous_allow_;
1015 1051
1016 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); 1052 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope);
1017 }; 1053 };
1018 1054
1019 1055
1020 class KeyedLoadElementStub : public CodeStub { 1056 class KeyedLoadDictionaryElementStub : public PlatformCodeStub {
1021 public: 1057 public:
1022 explicit KeyedLoadElementStub(ElementsKind elements_kind) 1058 explicit KeyedLoadDictionaryElementStub() {}
Jakob Kummerow 2012/11/28 16:28:22 nit: no need for "explicit"
danno 2012/11/30 16:23:24 Done.
1023 : elements_kind_(elements_kind)
1024 { }
1025 1059
1026 Major MajorKey() { return KeyedLoadElement; } 1060 Major MajorKey() { return KeyedLoadElement; }
1027 int MinorKey() { return elements_kind_; } 1061 int MinorKey() { return DICTIONARY_ELEMENTS; }
1028 1062
1029 void Generate(MacroAssembler* masm); 1063 void Generate(MacroAssembler* masm);
1030 1064
1031 private: 1065 private:
1032 ElementsKind elements_kind_; 1066 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub);
1033
1034 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub);
1035 }; 1067 };
1036 1068
1037 1069
1038 class KeyedStoreElementStub : public CodeStub { 1070 class KeyedLoadFastElementStub : public HydrogenCodeStub {
1071 public:
1072 explicit KeyedLoadFastElementStub(bool is_js_array,
Jakob Kummerow 2012/11/28 16:28:22 nit: no need for "explicit"
danno 2012/11/30 16:23:24 Done.
1073 ElementsKind elements_kind) {
1074 bit_field_ = ElementsKindBits::encode(elements_kind);
Jakob Kummerow 2012/11/28 16:28:22 nit: elsewhere, we use the pattern: bit_field_ = F
danno 2012/11/30 16:23:24 Done.
1075 bit_field_ = IsJSArrayBits::update(bit_field_, is_js_array);
1076 }
1077
1078 Major MajorKey() { return KeyedLoadElement; }
1079 int MinorKey() { return bit_field_; }
1080
1081 bool is_js_array() const {
1082 return IsJSArrayBits::decode(bit_field_);
1083 }
1084
1085 ElementsKind elements_kind() const {
1086 return ElementsKindBits::decode(bit_field_);
1087 }
1088
1089 virtual Handle<Code> GenerateCode();
1090
1091 virtual CodeStubInterfaceDescriptor* GetInterfaceDescriptor(
1092 Isolate* isolate);
1093
1094 private:
1095 class IsJSArrayBits: public BitField<bool, 8, 1> {};
1096 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
1097 uint32_t bit_field_;
1098
1099 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub);
1100 };
1101
1102
1103 class KeyedStoreElementStub : public PlatformCodeStub {
1039 public: 1104 public:
1040 KeyedStoreElementStub(bool is_js_array, 1105 KeyedStoreElementStub(bool is_js_array,
1041 ElementsKind elements_kind, 1106 ElementsKind elements_kind,
1042 KeyedAccessGrowMode grow_mode) 1107 KeyedAccessGrowMode grow_mode)
1043 : is_js_array_(is_js_array), 1108 : is_js_array_(is_js_array),
1044 elements_kind_(elements_kind), 1109 elements_kind_(elements_kind),
1045 grow_mode_(grow_mode), 1110 grow_mode_(grow_mode),
1046 fp_registers_(CanUseFPRegisters()) { } 1111 fp_registers_(CanUseFPRegisters()) { }
1047 1112
1048 Major MajorKey() { return KeyedStoreElement; } 1113 Major MajorKey() { return KeyedStoreElement; }
(...skipping 14 matching lines...) Expand all
1063 1128
1064 bool is_js_array_; 1129 bool is_js_array_;
1065 ElementsKind elements_kind_; 1130 ElementsKind elements_kind_;
1066 KeyedAccessGrowMode grow_mode_; 1131 KeyedAccessGrowMode grow_mode_;
1067 bool fp_registers_; 1132 bool fp_registers_;
1068 1133
1069 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); 1134 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub);
1070 }; 1135 };
1071 1136
1072 1137
1073 class ToBooleanStub: public CodeStub { 1138 class ToBooleanStub: public PlatformCodeStub {
1074 public: 1139 public:
1075 enum Type { 1140 enum Type {
1076 UNDEFINED, 1141 UNDEFINED,
1077 BOOLEAN, 1142 BOOLEAN,
1078 NULL_TYPE, 1143 NULL_TYPE,
1079 SMI, 1144 SMI,
1080 SPEC_OBJECT, 1145 SPEC_OBJECT,
1081 STRING, 1146 STRING,
1082 HEAP_NUMBER, 1147 HEAP_NUMBER,
1083 NUMBER_OF_TYPES 1148 NUMBER_OF_TYPES
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 Type type, 1198 Type type,
1134 Heap::RootListIndex value, 1199 Heap::RootListIndex value,
1135 bool result); 1200 bool result);
1136 void GenerateTypeTransition(MacroAssembler* masm); 1201 void GenerateTypeTransition(MacroAssembler* masm);
1137 1202
1138 Register tos_; 1203 Register tos_;
1139 Types types_; 1204 Types types_;
1140 }; 1205 };
1141 1206
1142 1207
1143 class ElementsTransitionAndStoreStub : public CodeStub { 1208 class ElementsTransitionAndStoreStub : public PlatformCodeStub {
1144 public: 1209 public:
1145 ElementsTransitionAndStoreStub(ElementsKind from, 1210 ElementsTransitionAndStoreStub(ElementsKind from,
1146 ElementsKind to, 1211 ElementsKind to,
1147 bool is_jsarray, 1212 bool is_jsarray,
1148 StrictModeFlag strict_mode, 1213 StrictModeFlag strict_mode,
1149 KeyedAccessGrowMode grow_mode) 1214 KeyedAccessGrowMode grow_mode)
1150 : from_(from), 1215 : from_(from),
1151 to_(to), 1216 to_(to),
1152 is_jsarray_(is_jsarray), 1217 is_jsarray_(is_jsarray),
1153 strict_mode_(strict_mode), 1218 strict_mode_(strict_mode),
(...skipping 20 matching lines...) Expand all
1174 ElementsKind from_; 1239 ElementsKind from_;
1175 ElementsKind to_; 1240 ElementsKind to_;
1176 bool is_jsarray_; 1241 bool is_jsarray_;
1177 StrictModeFlag strict_mode_; 1242 StrictModeFlag strict_mode_;
1178 KeyedAccessGrowMode grow_mode_; 1243 KeyedAccessGrowMode grow_mode_;
1179 1244
1180 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); 1245 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub);
1181 }; 1246 };
1182 1247
1183 1248
1184 class StoreArrayLiteralElementStub : public CodeStub { 1249 class StoreArrayLiteralElementStub : public PlatformCodeStub {
1185 public: 1250 public:
1186 StoreArrayLiteralElementStub() 1251 StoreArrayLiteralElementStub()
1187 : fp_registers_(CanUseFPRegisters()) { } 1252 : fp_registers_(CanUseFPRegisters()) { }
1188 1253
1189 private: 1254 private:
1190 class FPRegisters: public BitField<bool, 0, 1> {}; 1255 class FPRegisters: public BitField<bool, 0, 1> {};
1191 1256
1192 Major MajorKey() { return StoreArrayLiteralElement; } 1257 Major MajorKey() { return StoreArrayLiteralElement; }
1193 int MinorKey() { return FPRegisters::encode(fp_registers_); } 1258 int MinorKey() { return FPRegisters::encode(fp_registers_); }
1194 1259
1195 void Generate(MacroAssembler* masm); 1260 void Generate(MacroAssembler* masm);
1196 1261
1197 bool fp_registers_; 1262 bool fp_registers_;
1198 1263
1199 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1264 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1200 }; 1265 };
1201 1266
1202 1267
1203 class ProfileEntryHookStub : public CodeStub { 1268 class ProfileEntryHookStub : public PlatformCodeStub {
1204 public: 1269 public:
1205 explicit ProfileEntryHookStub() {} 1270 explicit ProfileEntryHookStub() {}
1206 1271
1207 // The profile entry hook function is not allowed to cause a GC. 1272 // The profile entry hook function is not allowed to cause a GC.
1208 virtual bool SometimesSetsUpAFrame() { return false; } 1273 virtual bool SometimesSetsUpAFrame() { return false; }
1209 1274
1210 // Generates a call to the entry hook if it's enabled. 1275 // Generates a call to the entry hook if it's enabled.
1211 static void MaybeCallEntryHook(MacroAssembler* masm); 1276 static void MaybeCallEntryHook(MacroAssembler* masm);
1212 1277
1213 // Sets or unsets the entry hook function. Returns true on success, 1278 // Sets or unsets the entry hook function. Returns true on success,
(...skipping 14 matching lines...) Expand all
1228 1293
1229 // The current function entry hook. 1294 // The current function entry hook.
1230 static FunctionEntryHook entry_hook_; 1295 static FunctionEntryHook entry_hook_;
1231 1296
1232 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 1297 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
1233 }; 1298 };
1234 1299
1235 } } // namespace v8::internal 1300 } } // namespace v8::internal
1236 1301
1237 #endif // V8_CODE_STUBS_H_ 1302 #endif // V8_CODE_STUBS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698