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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 | 420 |
421 class FastCloneShallowArrayStub : public PlatformCodeStub { | 421 class FastCloneShallowArrayStub : public PlatformCodeStub { |
422 public: | 422 public: |
423 // Maximum length of copied elements array. | 423 // Maximum length of copied elements array. |
424 static const int kMaximumClonedLength = 8; | 424 static const int kMaximumClonedLength = 8; |
425 enum Mode { | 425 enum Mode { |
426 CLONE_ELEMENTS, | 426 CLONE_ELEMENTS, |
427 CLONE_DOUBLE_ELEMENTS, | 427 CLONE_DOUBLE_ELEMENTS, |
428 COPY_ON_WRITE_ELEMENTS, | 428 COPY_ON_WRITE_ELEMENTS, |
429 CLONE_ANY_ELEMENTS, | 429 CLONE_ANY_ELEMENTS, |
430 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO, | 430 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS |
431 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO | |
432 }; | 431 }; |
433 | 432 |
434 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; | 433 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; |
435 | 434 |
436 FastCloneShallowArrayStub(Mode mode, int length) | 435 FastCloneShallowArrayStub(Mode mode, |
436 AllocationSiteMode allocation_site_mode, | |
437 int length) | |
437 : mode_(mode), | 438 : mode_(mode), |
439 allocation_site_mode_(allocation_site_mode), | |
438 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 440 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
439 ASSERT_GE(length_, 0); | 441 ASSERT_GE(length_, 0); |
440 ASSERT_LE(length_, kMaximumClonedLength); | 442 ASSERT_LE(length_, kMaximumClonedLength); |
441 } | 443 } |
442 | 444 |
443 void Generate(MacroAssembler* masm); | 445 void Generate(MacroAssembler* masm); |
444 | 446 |
445 private: | 447 private: |
446 Mode mode_; | 448 Mode mode_; |
449 AllocationSiteMode allocation_site_mode_; | |
447 int length_; | 450 int length_; |
448 | 451 |
452 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | |
453 class ModeBits: public BitField<Mode, 1, 4> {}; | |
454 class LengthBits: public BitField<int, 5, 5> {}; | |
Toon Verwaest
2013/01/16 13:35:55
You only need 4 bits here.
mvstanton
2013/01/16 14:21:00
Done.
| |
455 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1); | |
456 STATIC_ASSERT(kFastCloneModeCount <= 8); | |
457 STATIC_ASSERT(kMaximumClonedLength <= 8); | |
Toon Verwaest
2013/01/16 13:35:55
With 4 bits, this field supports < 16.
mvstanton
2013/01/16 14:21:00
Done.
| |
449 Major MajorKey() { return FastCloneShallowArray; } | 458 Major MajorKey() { return FastCloneShallowArray; } |
450 int MinorKey() { | 459 int MinorKey() { |
451 ASSERT(mode_ >= 0 && mode_ <= LAST_CLONE_MODE); | 460 return AllocationSiteModeBits::encode(allocation_site_mode_) |
452 return length_ * kFastCloneModeCount + mode_; | 461 | ModeBits::encode(mode_) |
462 | LengthBits::encode(length_); | |
453 } | 463 } |
454 }; | 464 }; |
455 | 465 |
456 | 466 |
457 class FastCloneShallowObjectStub : public PlatformCodeStub { | 467 class FastCloneShallowObjectStub : public PlatformCodeStub { |
458 public: | 468 public: |
459 // Maximum number of properties in copied object. | 469 // Maximum number of properties in copied object. |
460 static const int kMaximumClonedProperties = 6; | 470 static const int kMaximumClonedProperties = 6; |
461 | 471 |
462 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 472 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 | 1311 |
1302 // The current function entry hook. | 1312 // The current function entry hook. |
1303 static FunctionEntryHook entry_hook_; | 1313 static FunctionEntryHook entry_hook_; |
1304 | 1314 |
1305 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1315 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1306 }; | 1316 }; |
1307 | 1317 |
1308 } } // namespace v8::internal | 1318 } } // namespace v8::internal |
1309 | 1319 |
1310 #endif // V8_CODE_STUBS_H_ | 1320 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |