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; |
Toon Verwaest
2013/01/16 10:53:42
Keep empty line between these lines.
mvstanton
2013/01/16 13:01:56
Done.
| |
435 | 434 FastCloneShallowArrayStub(Mode mode, |
436 FastCloneShallowArrayStub(Mode mode, int length) | 435 AllocationSiteInfoMode allocation_site_info_mode, |
436 int length) | |
437 : mode_(mode), | 437 : mode_(mode), |
438 allocation_site_info_mode_(allocation_site_info_mode), | |
438 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 439 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
439 ASSERT_GE(length_, 0); | 440 ASSERT_GE(length_, 0); |
440 ASSERT_LE(length_, kMaximumClonedLength); | 441 ASSERT_LE(length_, kMaximumClonedLength); |
441 } | 442 } |
442 | 443 |
443 void Generate(MacroAssembler* masm); | 444 void Generate(MacroAssembler* masm); |
444 | 445 |
445 private: | 446 private: |
446 Mode mode_; | 447 Mode mode_; |
448 AllocationSiteInfoMode allocation_site_info_mode_; | |
447 int length_; | 449 int length_; |
448 | 450 |
451 class ModeBits: public BitField<Mode, 0, 8> {}; | |
452 class AllocationSiteInfoModeBits: public | |
453 BitField<AllocationSiteInfoMode, 8, 8> {}; | |
Toon Verwaest
2013/01/16 10:53:42
You only need 1 bit for this field.
mvstanton
2013/01/16 13:01:56
Fixed, and added a static assert to support it.
| |
454 class LengthBits: public BitField<int, 16, 16> {}; | |
455 STATIC_ASSERT(kFastCloneModeCount <= 8); | |
449 Major MajorKey() { return FastCloneShallowArray; } | 456 Major MajorKey() { return FastCloneShallowArray; } |
450 int MinorKey() { | 457 int MinorKey() { |
451 ASSERT(mode_ >= 0 && mode_ <= LAST_CLONE_MODE); | 458 return ModeBits::encode(mode_) |
452 return length_ * kFastCloneModeCount + mode_; | 459 | AllocationSiteInfoModeBits::encode(allocation_site_info_mode_) |
460 | LengthBits::encode(length_); | |
453 } | 461 } |
454 }; | 462 }; |
455 | 463 |
456 | 464 |
457 class FastCloneShallowObjectStub : public PlatformCodeStub { | 465 class FastCloneShallowObjectStub : public PlatformCodeStub { |
458 public: | 466 public: |
459 // Maximum number of properties in copied object. | 467 // Maximum number of properties in copied object. |
460 static const int kMaximumClonedProperties = 6; | 468 static const int kMaximumClonedProperties = 6; |
461 | 469 |
462 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 470 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 | 1309 |
1302 // The current function entry hook. | 1310 // The current function entry hook. |
1303 static FunctionEntryHook entry_hook_; | 1311 static FunctionEntryHook entry_hook_; |
1304 | 1312 |
1305 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1313 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1306 }; | 1314 }; |
1307 | 1315 |
1308 } } // namespace v8::internal | 1316 } } // namespace v8::internal |
1309 | 1317 |
1310 #endif // V8_CODE_STUBS_H_ | 1318 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |