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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); | 163 bool FindCodeInCache(Code** code_out); |
164 | 164 |
165 protected: | 165 protected: |
166 static bool CanUseFPRegisters(); | 166 static bool CanUseFPRegisters(); |
167 | 167 |
168 private: | 168 private: |
169 // Nonvirtual wrapper around the stub-specific Generate function. Call | 169 friend class PlatformCodeStub; |
170 // this function to set up the macro assembler and generate the code. | |
171 void GenerateCode(MacroAssembler* masm); | |
172 | 170 |
173 // Generates the assembler code for the stub. | 171 // Generates the assembler code for the stub. |
174 virtual void Generate(MacroAssembler* masm) = 0; | 172 virtual Handle<Code> GenerateCode() = 0; |
175 | 173 |
176 // Perform bookkeeping required after code generation when stub code is | 174 // Perform bookkeeping required after code generation when stub code is |
177 // initially generated. | 175 // initially generated. |
178 void RecordCodeGeneration(Code* code, MacroAssembler* masm); | 176 void RecordCodeGeneration(Code* code, Isolate* isolate); |
179 | 177 |
180 // Finish the code object after it has been generated. | 178 // Finish the code object after it has been generated. |
181 virtual void FinishCode(Handle<Code> code) { } | 179 virtual void FinishCode(Handle<Code> code) { } |
182 | 180 |
183 // Activate newly generated stub. Is called after | 181 // Activate newly generated stub. Is called after |
184 // registering stub in the stub cache. | 182 // registering stub in the stub cache. |
185 virtual void Activate(Code* code) { } | 183 virtual void Activate(Code* code) { } |
186 | 184 |
187 // Returns information for computing the number key. | 185 // Returns information for computing the number key. |
188 virtual Major MajorKey() = 0; | 186 virtual Major MajorKey() = 0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 221 } |
224 | 222 |
225 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; | 223 class MajorKeyBits: public BitField<uint32_t, 0, kStubMajorKeyBits> {}; |
226 class MinorKeyBits: public BitField<uint32_t, | 224 class MinorKeyBits: public BitField<uint32_t, |
227 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT | 225 kStubMajorKeyBits, kStubMinorKeyBits> {}; // NOLINT |
228 | 226 |
229 friend class BreakPointIterator; | 227 friend class BreakPointIterator; |
230 }; | 228 }; |
231 | 229 |
232 | 230 |
| 231 class PlatformCodeStub : public CodeStub { |
| 232 public: |
| 233 // Retrieve the code for the stub. Generate the code if needed. |
| 234 virtual Handle<Code> GenerateCode(); |
| 235 |
| 236 virtual int GetCodeKind() { return Code::STUB; } |
| 237 |
| 238 protected: |
| 239 // Generates the assembler code for the stub. |
| 240 virtual void Generate(MacroAssembler* masm) = 0; |
| 241 }; |
| 242 |
| 243 |
| 244 class HGraph; |
| 245 class HydrogenCodeStub : public CodeStub { |
| 246 public: |
| 247 // Retrieve the code for the stub. Generate the code if needed. |
| 248 virtual Handle<Code> GenerateCode(); |
| 249 |
| 250 virtual int GetCodeKind() { return Code::COMPILED_STUB; } |
| 251 |
| 252 protected: |
| 253 virtual void Generate(HGraph* graph) = 0; |
| 254 }; |
| 255 |
| 256 |
233 // Helper interface to prepare to/restore after making runtime calls. | 257 // Helper interface to prepare to/restore after making runtime calls. |
234 class RuntimeCallHelper { | 258 class RuntimeCallHelper { |
235 public: | 259 public: |
236 virtual ~RuntimeCallHelper() {} | 260 virtual ~RuntimeCallHelper() {} |
237 | 261 |
238 virtual void BeforeCall(MacroAssembler* masm) const = 0; | 262 virtual void BeforeCall(MacroAssembler* masm) const = 0; |
239 | 263 |
240 virtual void AfterCall(MacroAssembler* masm) const = 0; | 264 virtual void AfterCall(MacroAssembler* masm) const = 0; |
241 | 265 |
242 protected: | 266 protected: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 class NopRuntimeCallHelper : public RuntimeCallHelper { | 304 class NopRuntimeCallHelper : public RuntimeCallHelper { |
281 public: | 305 public: |
282 NopRuntimeCallHelper() {} | 306 NopRuntimeCallHelper() {} |
283 | 307 |
284 virtual void BeforeCall(MacroAssembler* masm) const {} | 308 virtual void BeforeCall(MacroAssembler* masm) const {} |
285 | 309 |
286 virtual void AfterCall(MacroAssembler* masm) const {} | 310 virtual void AfterCall(MacroAssembler* masm) const {} |
287 }; | 311 }; |
288 | 312 |
289 | 313 |
290 class StackCheckStub : public CodeStub { | 314 class StackCheckStub : public PlatformCodeStub { |
291 public: | 315 public: |
292 StackCheckStub() { } | 316 StackCheckStub() { } |
293 | 317 |
294 void Generate(MacroAssembler* masm); | 318 void Generate(MacroAssembler* masm); |
295 | 319 |
296 private: | 320 private: |
297 Major MajorKey() { return StackCheck; } | 321 Major MajorKey() { return StackCheck; } |
298 int MinorKey() { return 0; } | 322 int MinorKey() { return 0; } |
299 }; | 323 }; |
300 | 324 |
301 | 325 |
302 class InterruptStub : public CodeStub { | 326 class InterruptStub : public PlatformCodeStub { |
303 public: | 327 public: |
304 InterruptStub() { } | 328 InterruptStub() { } |
305 | 329 |
306 void Generate(MacroAssembler* masm); | 330 void Generate(MacroAssembler* masm); |
307 | 331 |
308 private: | 332 private: |
309 Major MajorKey() { return Interrupt; } | 333 Major MajorKey() { return Interrupt; } |
310 int MinorKey() { return 0; } | 334 int MinorKey() { return 0; } |
311 }; | 335 }; |
312 | 336 |
313 | 337 |
314 class ToNumberStub: public CodeStub { | 338 class ToNumberStub: public PlatformCodeStub { |
315 public: | 339 public: |
316 ToNumberStub() { } | 340 ToNumberStub() { } |
317 | 341 |
318 void Generate(MacroAssembler* masm); | 342 void Generate(MacroAssembler* masm); |
319 | 343 |
320 private: | 344 private: |
321 Major MajorKey() { return ToNumber; } | 345 Major MajorKey() { return ToNumber; } |
322 int MinorKey() { return 0; } | 346 int MinorKey() { return 0; } |
323 }; | 347 }; |
324 | 348 |
325 | 349 |
326 class FastNewClosureStub : public CodeStub { | 350 class FastNewClosureStub : public PlatformCodeStub { |
327 public: | 351 public: |
328 explicit FastNewClosureStub(LanguageMode language_mode) | 352 explicit FastNewClosureStub(LanguageMode language_mode) |
329 : language_mode_(language_mode) { } | 353 : language_mode_(language_mode) { } |
330 | 354 |
331 void Generate(MacroAssembler* masm); | 355 void Generate(MacroAssembler* masm); |
332 | 356 |
333 private: | 357 private: |
334 Major MajorKey() { return FastNewClosure; } | 358 Major MajorKey() { return FastNewClosure; } |
335 int MinorKey() { return language_mode_ == CLASSIC_MODE | 359 int MinorKey() { return language_mode_ == CLASSIC_MODE |
336 ? kNonStrictMode : kStrictMode; } | 360 ? kNonStrictMode : kStrictMode; } |
337 | 361 |
338 LanguageMode language_mode_; | 362 LanguageMode language_mode_; |
339 }; | 363 }; |
340 | 364 |
341 | 365 |
342 class FastNewContextStub : public CodeStub { | 366 class FastNewContextStub : public PlatformCodeStub { |
343 public: | 367 public: |
344 static const int kMaximumSlots = 64; | 368 static const int kMaximumSlots = 64; |
345 | 369 |
346 explicit FastNewContextStub(int slots) : slots_(slots) { | 370 explicit FastNewContextStub(int slots) : slots_(slots) { |
347 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); | 371 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); |
348 } | 372 } |
349 | 373 |
350 void Generate(MacroAssembler* masm); | 374 void Generate(MacroAssembler* masm); |
351 | 375 |
352 private: | 376 private: |
353 int slots_; | 377 int slots_; |
354 | 378 |
355 Major MajorKey() { return FastNewContext; } | 379 Major MajorKey() { return FastNewContext; } |
356 int MinorKey() { return slots_; } | 380 int MinorKey() { return slots_; } |
357 }; | 381 }; |
358 | 382 |
359 | 383 |
360 class FastNewBlockContextStub : public CodeStub { | 384 class FastNewBlockContextStub : public PlatformCodeStub { |
361 public: | 385 public: |
362 static const int kMaximumSlots = 64; | 386 static const int kMaximumSlots = 64; |
363 | 387 |
364 explicit FastNewBlockContextStub(int slots) : slots_(slots) { | 388 explicit FastNewBlockContextStub(int slots) : slots_(slots) { |
365 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); | 389 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); |
366 } | 390 } |
367 | 391 |
368 void Generate(MacroAssembler* masm); | 392 void Generate(MacroAssembler* masm); |
369 | 393 |
370 private: | 394 private: |
371 int slots_; | 395 int slots_; |
372 | 396 |
373 Major MajorKey() { return FastNewBlockContext; } | 397 Major MajorKey() { return FastNewBlockContext; } |
374 int MinorKey() { return slots_; } | 398 int MinorKey() { return slots_; } |
375 }; | 399 }; |
376 | 400 |
377 | 401 |
378 class FastCloneShallowArrayStub : public CodeStub { | 402 class FastCloneShallowArrayStub : public PlatformCodeStub { |
379 public: | 403 public: |
380 // Maximum length of copied elements array. | 404 // Maximum length of copied elements array. |
381 static const int kMaximumClonedLength = 8; | 405 static const int kMaximumClonedLength = 8; |
382 | 406 |
383 enum Mode { | 407 enum Mode { |
384 CLONE_ELEMENTS, | 408 CLONE_ELEMENTS, |
385 CLONE_DOUBLE_ELEMENTS, | 409 CLONE_DOUBLE_ELEMENTS, |
386 COPY_ON_WRITE_ELEMENTS, | 410 COPY_ON_WRITE_ELEMENTS, |
387 CLONE_ANY_ELEMENTS | 411 CLONE_ANY_ELEMENTS |
388 }; | 412 }; |
(...skipping 12 matching lines...) Expand all Loading... |
401 int length_; | 425 int length_; |
402 | 426 |
403 Major MajorKey() { return FastCloneShallowArray; } | 427 Major MajorKey() { return FastCloneShallowArray; } |
404 int MinorKey() { | 428 int MinorKey() { |
405 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); | 429 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); |
406 return length_ * 4 + mode_; | 430 return length_ * 4 + mode_; |
407 } | 431 } |
408 }; | 432 }; |
409 | 433 |
410 | 434 |
411 class FastCloneShallowObjectStub : public CodeStub { | 435 class FastCloneShallowObjectStub : public PlatformCodeStub { |
412 public: | 436 public: |
413 // Maximum number of properties in copied object. | 437 // Maximum number of properties in copied object. |
414 static const int kMaximumClonedProperties = 6; | 438 static const int kMaximumClonedProperties = 6; |
415 | 439 |
416 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 440 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
417 ASSERT_GE(length_, 0); | 441 ASSERT_GE(length_, 0); |
418 ASSERT_LE(length_, kMaximumClonedProperties); | 442 ASSERT_LE(length_, kMaximumClonedProperties); |
419 } | 443 } |
420 | 444 |
421 void Generate(MacroAssembler* masm); | 445 void Generate(MacroAssembler* masm); |
422 | 446 |
423 private: | 447 private: |
424 int length_; | 448 int length_; |
425 | 449 |
426 Major MajorKey() { return FastCloneShallowObject; } | 450 Major MajorKey() { return FastCloneShallowObject; } |
427 int MinorKey() { return length_; } | 451 int MinorKey() { return length_; } |
428 }; | 452 }; |
429 | 453 |
430 | 454 |
431 class InstanceofStub: public CodeStub { | 455 class InstanceofStub: public PlatformCodeStub { |
432 public: | 456 public: |
433 enum Flags { | 457 enum Flags { |
434 kNoFlags = 0, | 458 kNoFlags = 0, |
435 kArgsInRegisters = 1 << 0, | 459 kArgsInRegisters = 1 << 0, |
436 kCallSiteInlineCheck = 1 << 1, | 460 kCallSiteInlineCheck = 1 << 1, |
437 kReturnTrueFalseObject = 1 << 2 | 461 kReturnTrueFalseObject = 1 << 2 |
438 }; | 462 }; |
439 | 463 |
440 explicit InstanceofStub(Flags flags) : flags_(flags) { } | 464 explicit InstanceofStub(Flags flags) : flags_(flags) { } |
441 | 465 |
(...skipping 17 matching lines...) Expand all Loading... |
459 bool ReturnTrueFalseObject() const { | 483 bool ReturnTrueFalseObject() const { |
460 return (flags_ & kReturnTrueFalseObject) != 0; | 484 return (flags_ & kReturnTrueFalseObject) != 0; |
461 } | 485 } |
462 | 486 |
463 virtual void PrintName(StringStream* stream); | 487 virtual void PrintName(StringStream* stream); |
464 | 488 |
465 Flags flags_; | 489 Flags flags_; |
466 }; | 490 }; |
467 | 491 |
468 | 492 |
469 class MathPowStub: public CodeStub { | 493 class MathPowStub: public PlatformCodeStub { |
470 public: | 494 public: |
471 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; | 495 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; |
472 | 496 |
473 explicit MathPowStub(ExponentType exponent_type) | 497 explicit MathPowStub(ExponentType exponent_type) |
474 : exponent_type_(exponent_type) { } | 498 : exponent_type_(exponent_type) { } |
475 virtual void Generate(MacroAssembler* masm); | 499 virtual void Generate(MacroAssembler* masm); |
476 | 500 |
477 private: | 501 private: |
478 virtual CodeStub::Major MajorKey() { return MathPow; } | 502 virtual CodeStub::Major MajorKey() { return MathPow; } |
479 virtual int MinorKey() { return exponent_type_; } | 503 virtual int MinorKey() { return exponent_type_; } |
480 | 504 |
481 ExponentType exponent_type_; | 505 ExponentType exponent_type_; |
482 }; | 506 }; |
483 | 507 |
484 | 508 |
485 class ICCompareStub: public CodeStub { | 509 class ICCompareStub: public PlatformCodeStub { |
486 public: | 510 public: |
487 ICCompareStub(Token::Value op, CompareIC::State state) | 511 ICCompareStub(Token::Value op, CompareIC::State state) |
488 : op_(op), state_(state) { | 512 : op_(op), state_(state) { |
489 ASSERT(Token::IsCompareOp(op)); | 513 ASSERT(Token::IsCompareOp(op)); |
490 } | 514 } |
491 | 515 |
492 virtual void Generate(MacroAssembler* masm); | 516 virtual void Generate(MacroAssembler* masm); |
493 | 517 |
494 void set_known_map(Handle<Map> map) { known_map_ = map; } | 518 void set_known_map(Handle<Map> map) { known_map_ = map; } |
495 | 519 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 CANT_BOTH_BE_NAN = 1 << 2 | 560 CANT_BOTH_BE_NAN = 1 << 2 |
537 }; | 561 }; |
538 | 562 |
539 | 563 |
540 enum NaNInformation { | 564 enum NaNInformation { |
541 kBothCouldBeNaN, | 565 kBothCouldBeNaN, |
542 kCantBothBeNaN | 566 kCantBothBeNaN |
543 }; | 567 }; |
544 | 568 |
545 | 569 |
546 class CompareStub: public CodeStub { | 570 class CompareStub: public PlatformCodeStub { |
547 public: | 571 public: |
548 CompareStub(Condition cc, | 572 CompareStub(Condition cc, |
549 bool strict, | 573 bool strict, |
550 CompareFlags flags, | 574 CompareFlags flags, |
551 Register lhs, | 575 Register lhs, |
552 Register rhs) : | 576 Register rhs) : |
553 cc_(cc), | 577 cc_(cc), |
554 strict_(strict), | 578 strict_(strict), |
555 never_nan_nan_((flags & CANT_BOTH_BE_NAN) != 0), | 579 never_nan_nan_((flags & CANT_BOTH_BE_NAN) != 0), |
556 include_number_compare_((flags & NO_NUMBER_COMPARE_IN_STUB) == 0), | 580 include_number_compare_((flags & NO_NUMBER_COMPARE_IN_STUB) == 0), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 Label* label, | 642 Label* label, |
619 Register object, | 643 Register object, |
620 Register scratch); | 644 Register scratch); |
621 | 645 |
622 // Unfortunately you have to run without snapshots to see most of these | 646 // Unfortunately you have to run without snapshots to see most of these |
623 // names in the profile since most compare stubs end up in the snapshot. | 647 // names in the profile since most compare stubs end up in the snapshot. |
624 virtual void PrintName(StringStream* stream); | 648 virtual void PrintName(StringStream* stream); |
625 }; | 649 }; |
626 | 650 |
627 | 651 |
628 class CEntryStub : public CodeStub { | 652 class CEntryStub : public PlatformCodeStub { |
629 public: | 653 public: |
630 explicit CEntryStub(int result_size, | 654 explicit CEntryStub(int result_size, |
631 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 655 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
632 : result_size_(result_size), save_doubles_(save_doubles) { } | 656 : result_size_(result_size), save_doubles_(save_doubles) { } |
633 | 657 |
634 void Generate(MacroAssembler* masm); | 658 void Generate(MacroAssembler* masm); |
635 | 659 |
636 // The version of this stub that doesn't save doubles is generated ahead of | 660 // The version of this stub that doesn't save doubles is generated ahead of |
637 // time, so it's OK to call it from other stubs that can't cope with GC during | 661 // time, so it's OK to call it from other stubs that can't cope with GC during |
638 // their code generation. On machines that always have gp registers (x64) we | 662 // their code generation. On machines that always have gp registers (x64) we |
(...skipping 13 matching lines...) Expand all Loading... |
652 const int result_size_; | 676 const int result_size_; |
653 SaveFPRegsMode save_doubles_; | 677 SaveFPRegsMode save_doubles_; |
654 | 678 |
655 Major MajorKey() { return CEntry; } | 679 Major MajorKey() { return CEntry; } |
656 int MinorKey(); | 680 int MinorKey(); |
657 | 681 |
658 bool NeedsImmovableCode(); | 682 bool NeedsImmovableCode(); |
659 }; | 683 }; |
660 | 684 |
661 | 685 |
662 class JSEntryStub : public CodeStub { | 686 class JSEntryStub : public PlatformCodeStub { |
663 public: | 687 public: |
664 JSEntryStub() { } | 688 JSEntryStub() { } |
665 | 689 |
666 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } | 690 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } |
667 | 691 |
668 protected: | 692 protected: |
669 void GenerateBody(MacroAssembler* masm, bool is_construct); | 693 void GenerateBody(MacroAssembler* masm, bool is_construct); |
670 | 694 |
671 private: | 695 private: |
672 Major MajorKey() { return JSEntry; } | 696 Major MajorKey() { return JSEntry; } |
(...skipping 13 matching lines...) Expand all Loading... |
686 | 710 |
687 private: | 711 private: |
688 int MinorKey() { return 1; } | 712 int MinorKey() { return 1; } |
689 | 713 |
690 virtual void PrintName(StringStream* stream) { | 714 virtual void PrintName(StringStream* stream) { |
691 stream->Add("JSConstructEntryStub"); | 715 stream->Add("JSConstructEntryStub"); |
692 } | 716 } |
693 }; | 717 }; |
694 | 718 |
695 | 719 |
696 class ArgumentsAccessStub: public CodeStub { | 720 class ArgumentsAccessStub: public PlatformCodeStub { |
697 public: | 721 public: |
698 enum Type { | 722 enum Type { |
699 READ_ELEMENT, | 723 READ_ELEMENT, |
700 NEW_NON_STRICT_FAST, | 724 NEW_NON_STRICT_FAST, |
701 NEW_NON_STRICT_SLOW, | 725 NEW_NON_STRICT_SLOW, |
702 NEW_STRICT | 726 NEW_STRICT |
703 }; | 727 }; |
704 | 728 |
705 explicit ArgumentsAccessStub(Type type) : type_(type) { } | 729 explicit ArgumentsAccessStub(Type type) : type_(type) { } |
706 | 730 |
707 private: | 731 private: |
708 Type type_; | 732 Type type_; |
709 | 733 |
710 Major MajorKey() { return ArgumentsAccess; } | 734 Major MajorKey() { return ArgumentsAccess; } |
711 int MinorKey() { return type_; } | 735 int MinorKey() { return type_; } |
712 | 736 |
713 void Generate(MacroAssembler* masm); | 737 void Generate(MacroAssembler* masm); |
714 void GenerateReadElement(MacroAssembler* masm); | 738 void GenerateReadElement(MacroAssembler* masm); |
715 void GenerateNewStrict(MacroAssembler* masm); | 739 void GenerateNewStrict(MacroAssembler* masm); |
716 void GenerateNewNonStrictFast(MacroAssembler* masm); | 740 void GenerateNewNonStrictFast(MacroAssembler* masm); |
717 void GenerateNewNonStrictSlow(MacroAssembler* masm); | 741 void GenerateNewNonStrictSlow(MacroAssembler* masm); |
718 | 742 |
719 virtual void PrintName(StringStream* stream); | 743 virtual void PrintName(StringStream* stream); |
720 }; | 744 }; |
721 | 745 |
722 | 746 |
723 class RegExpExecStub: public CodeStub { | 747 class RegExpExecStub: public PlatformCodeStub { |
724 public: | 748 public: |
725 RegExpExecStub() { } | 749 RegExpExecStub() { } |
726 | 750 |
727 private: | 751 private: |
728 Major MajorKey() { return RegExpExec; } | 752 Major MajorKey() { return RegExpExec; } |
729 int MinorKey() { return 0; } | 753 int MinorKey() { return 0; } |
730 | 754 |
731 void Generate(MacroAssembler* masm); | 755 void Generate(MacroAssembler* masm); |
732 }; | 756 }; |
733 | 757 |
734 | 758 |
735 class RegExpConstructResultStub: public CodeStub { | 759 class RegExpConstructResultStub: public PlatformCodeStub { |
736 public: | 760 public: |
737 RegExpConstructResultStub() { } | 761 RegExpConstructResultStub() { } |
738 | 762 |
739 private: | 763 private: |
740 Major MajorKey() { return RegExpConstructResult; } | 764 Major MajorKey() { return RegExpConstructResult; } |
741 int MinorKey() { return 0; } | 765 int MinorKey() { return 0; } |
742 | 766 |
743 void Generate(MacroAssembler* masm); | 767 void Generate(MacroAssembler* masm); |
744 }; | 768 }; |
745 | 769 |
746 | 770 |
747 class CallFunctionStub: public CodeStub { | 771 class CallFunctionStub: public PlatformCodeStub { |
748 public: | 772 public: |
749 CallFunctionStub(int argc, CallFunctionFlags flags) | 773 CallFunctionStub(int argc, CallFunctionFlags flags) |
750 : argc_(argc), flags_(flags) { } | 774 : argc_(argc), flags_(flags) { } |
751 | 775 |
752 void Generate(MacroAssembler* masm); | 776 void Generate(MacroAssembler* masm); |
753 | 777 |
754 virtual void FinishCode(Handle<Code> code) { | 778 virtual void FinishCode(Handle<Code> code) { |
755 code->set_has_function_cache(RecordCallTarget()); | 779 code->set_has_function_cache(RecordCallTarget()); |
756 } | 780 } |
757 | 781 |
(...skipping 20 matching lines...) Expand all Loading... |
778 bool ReceiverMightBeImplicit() { | 802 bool ReceiverMightBeImplicit() { |
779 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; | 803 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; |
780 } | 804 } |
781 | 805 |
782 bool RecordCallTarget() { | 806 bool RecordCallTarget() { |
783 return (flags_ & RECORD_CALL_TARGET) != 0; | 807 return (flags_ & RECORD_CALL_TARGET) != 0; |
784 } | 808 } |
785 }; | 809 }; |
786 | 810 |
787 | 811 |
788 class CallConstructStub: public CodeStub { | 812 class CallConstructStub: public PlatformCodeStub { |
789 public: | 813 public: |
790 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} | 814 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} |
791 | 815 |
792 void Generate(MacroAssembler* masm); | 816 void Generate(MacroAssembler* masm); |
793 | 817 |
794 virtual void FinishCode(Handle<Code> code) { | 818 virtual void FinishCode(Handle<Code> code) { |
795 code->set_has_function_cache(RecordCallTarget()); | 819 code->set_has_function_cache(RecordCallTarget()); |
796 } | 820 } |
797 | 821 |
798 private: | 822 private: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 } | 993 } |
970 | 994 |
971 private: | 995 private: |
972 MacroAssembler* masm_; | 996 MacroAssembler* masm_; |
973 bool previous_allow_; | 997 bool previous_allow_; |
974 | 998 |
975 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); | 999 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); |
976 }; | 1000 }; |
977 | 1001 |
978 | 1002 |
979 class KeyedLoadElementStub : public CodeStub { | 1003 class KeyedLoadDictionaryElementStub : public PlatformCodeStub { |
980 public: | 1004 public: |
981 explicit KeyedLoadElementStub(ElementsKind elements_kind) | 1005 explicit KeyedLoadDictionaryElementStub() {} |
982 : elements_kind_(elements_kind) | |
983 { } | |
984 | 1006 |
985 Major MajorKey() { return KeyedLoadElement; } | 1007 Major MajorKey() { return KeyedLoadElement; } |
986 int MinorKey() { return elements_kind_; } | 1008 int MinorKey() { return DICTIONARY_ELEMENTS; } |
987 | 1009 |
988 void Generate(MacroAssembler* masm); | 1010 void Generate(MacroAssembler* masm); |
989 | 1011 |
990 private: | 1012 private: |
991 ElementsKind elements_kind_; | 1013 DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub); |
992 | |
993 DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub); | |
994 }; | 1014 }; |
995 | 1015 |
996 | 1016 |
997 class KeyedStoreElementStub : public CodeStub { | 1017 class KeyedLoadFastElementStub : public HydrogenCodeStub { |
| 1018 public: |
| 1019 explicit KeyedLoadFastElementStub(bool is_js_array, |
| 1020 ElementsKind elements_kind) { |
| 1021 bit_field_ = ElementsKindBits::encode(elements_kind); |
| 1022 bit_field_ = IsJSArrayBits::update(bit_field_, is_js_array); |
| 1023 } |
| 1024 |
| 1025 virtual void Generate(HGraph* graph); |
| 1026 |
| 1027 Major MajorKey() { return KeyedLoadElement; } |
| 1028 int MinorKey() { return bit_field_; } |
| 1029 |
| 1030 bool is_js_array() const { |
| 1031 return IsJSArrayBits::decode(bit_field_); |
| 1032 } |
| 1033 |
| 1034 ElementsKind elements_kind() const { |
| 1035 return ElementsKindBits::decode(bit_field_); |
| 1036 } |
| 1037 |
| 1038 private: |
| 1039 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| 1040 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1041 uint32_t bit_field_; |
| 1042 |
| 1043 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); |
| 1044 }; |
| 1045 |
| 1046 |
| 1047 class KeyedStoreElementStub : public PlatformCodeStub { |
998 public: | 1048 public: |
999 KeyedStoreElementStub(bool is_js_array, | 1049 KeyedStoreElementStub(bool is_js_array, |
1000 ElementsKind elements_kind, | 1050 ElementsKind elements_kind, |
1001 KeyedAccessGrowMode grow_mode) | 1051 KeyedAccessGrowMode grow_mode) |
1002 : is_js_array_(is_js_array), | 1052 : is_js_array_(is_js_array), |
1003 elements_kind_(elements_kind), | 1053 elements_kind_(elements_kind), |
1004 grow_mode_(grow_mode), | 1054 grow_mode_(grow_mode), |
1005 fp_registers_(CanUseFPRegisters()) { } | 1055 fp_registers_(CanUseFPRegisters()) { } |
1006 | 1056 |
1007 Major MajorKey() { return KeyedStoreElement; } | 1057 Major MajorKey() { return KeyedStoreElement; } |
(...skipping 14 matching lines...) Expand all Loading... |
1022 | 1072 |
1023 bool is_js_array_; | 1073 bool is_js_array_; |
1024 ElementsKind elements_kind_; | 1074 ElementsKind elements_kind_; |
1025 KeyedAccessGrowMode grow_mode_; | 1075 KeyedAccessGrowMode grow_mode_; |
1026 bool fp_registers_; | 1076 bool fp_registers_; |
1027 | 1077 |
1028 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); | 1078 DISALLOW_COPY_AND_ASSIGN(KeyedStoreElementStub); |
1029 }; | 1079 }; |
1030 | 1080 |
1031 | 1081 |
1032 class ToBooleanStub: public CodeStub { | 1082 class ToBooleanStub: public PlatformCodeStub { |
1033 public: | 1083 public: |
1034 enum Type { | 1084 enum Type { |
1035 UNDEFINED, | 1085 UNDEFINED, |
1036 BOOLEAN, | 1086 BOOLEAN, |
1037 NULL_TYPE, | 1087 NULL_TYPE, |
1038 SMI, | 1088 SMI, |
1039 SPEC_OBJECT, | 1089 SPEC_OBJECT, |
1040 STRING, | 1090 STRING, |
1041 HEAP_NUMBER, | 1091 HEAP_NUMBER, |
1042 NUMBER_OF_TYPES | 1092 NUMBER_OF_TYPES |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 Type type, | 1139 Type type, |
1090 Heap::RootListIndex value, | 1140 Heap::RootListIndex value, |
1091 bool result); | 1141 bool result); |
1092 void GenerateTypeTransition(MacroAssembler* masm); | 1142 void GenerateTypeTransition(MacroAssembler* masm); |
1093 | 1143 |
1094 Register tos_; | 1144 Register tos_; |
1095 Types types_; | 1145 Types types_; |
1096 }; | 1146 }; |
1097 | 1147 |
1098 | 1148 |
1099 class ElementsTransitionAndStoreStub : public CodeStub { | 1149 class ElementsTransitionAndStoreStub : public PlatformCodeStub { |
1100 public: | 1150 public: |
1101 ElementsTransitionAndStoreStub(ElementsKind from, | 1151 ElementsTransitionAndStoreStub(ElementsKind from, |
1102 ElementsKind to, | 1152 ElementsKind to, |
1103 bool is_jsarray, | 1153 bool is_jsarray, |
1104 StrictModeFlag strict_mode, | 1154 StrictModeFlag strict_mode, |
1105 KeyedAccessGrowMode grow_mode) | 1155 KeyedAccessGrowMode grow_mode) |
1106 : from_(from), | 1156 : from_(from), |
1107 to_(to), | 1157 to_(to), |
1108 is_jsarray_(is_jsarray), | 1158 is_jsarray_(is_jsarray), |
1109 strict_mode_(strict_mode), | 1159 strict_mode_(strict_mode), |
(...skipping 20 matching lines...) Expand all Loading... |
1130 ElementsKind from_; | 1180 ElementsKind from_; |
1131 ElementsKind to_; | 1181 ElementsKind to_; |
1132 bool is_jsarray_; | 1182 bool is_jsarray_; |
1133 StrictModeFlag strict_mode_; | 1183 StrictModeFlag strict_mode_; |
1134 KeyedAccessGrowMode grow_mode_; | 1184 KeyedAccessGrowMode grow_mode_; |
1135 | 1185 |
1136 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); | 1186 DISALLOW_COPY_AND_ASSIGN(ElementsTransitionAndStoreStub); |
1137 }; | 1187 }; |
1138 | 1188 |
1139 | 1189 |
1140 class StoreArrayLiteralElementStub : public CodeStub { | 1190 class StoreArrayLiteralElementStub : public PlatformCodeStub { |
1141 public: | 1191 public: |
1142 StoreArrayLiteralElementStub() | 1192 StoreArrayLiteralElementStub() |
1143 : fp_registers_(CanUseFPRegisters()) { } | 1193 : fp_registers_(CanUseFPRegisters()) { } |
1144 | 1194 |
1145 private: | 1195 private: |
1146 class FPRegisters: public BitField<bool, 0, 1> {}; | 1196 class FPRegisters: public BitField<bool, 0, 1> {}; |
1147 | 1197 |
1148 Major MajorKey() { return StoreArrayLiteralElement; } | 1198 Major MajorKey() { return StoreArrayLiteralElement; } |
1149 int MinorKey() { return FPRegisters::encode(fp_registers_); } | 1199 int MinorKey() { return FPRegisters::encode(fp_registers_); } |
1150 | 1200 |
1151 void Generate(MacroAssembler* masm); | 1201 void Generate(MacroAssembler* masm); |
1152 | 1202 |
1153 bool fp_registers_; | 1203 bool fp_registers_; |
1154 | 1204 |
1155 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1205 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1156 }; | 1206 }; |
1157 | 1207 |
1158 | 1208 |
1159 class ProfileEntryHookStub : public CodeStub { | 1209 class ProfileEntryHookStub : public PlatformCodeStub { |
1160 public: | 1210 public: |
1161 explicit ProfileEntryHookStub() {} | 1211 explicit ProfileEntryHookStub() {} |
1162 | 1212 |
1163 // The profile entry hook function is not allowed to cause a GC. | 1213 // The profile entry hook function is not allowed to cause a GC. |
1164 virtual bool SometimesSetsUpAFrame() { return false; } | 1214 virtual bool SometimesSetsUpAFrame() { return false; } |
1165 | 1215 |
1166 // Generates a call to the entry hook if it's enabled. | 1216 // Generates a call to the entry hook if it's enabled. |
1167 static void MaybeCallEntryHook(MacroAssembler* masm); | 1217 static void MaybeCallEntryHook(MacroAssembler* masm); |
1168 | 1218 |
1169 // Sets or unsets the entry hook function. Returns true on success, | 1219 // Sets or unsets the entry hook function. Returns true on success, |
(...skipping 14 matching lines...) Expand all Loading... |
1184 | 1234 |
1185 // The current function entry hook. | 1235 // The current function entry hook. |
1186 static FunctionEntryHook entry_hook_; | 1236 static FunctionEntryHook entry_hook_; |
1187 | 1237 |
1188 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1238 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1189 }; | 1239 }; |
1190 | 1240 |
1191 } } // namespace v8::internal | 1241 } } // namespace v8::internal |
1192 | 1242 |
1193 #endif // V8_CODE_STUBS_H_ | 1243 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |