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

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

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

Powered by Google App Engine
This is Rietveld 408576698