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, 4> {}; |
| 455 // Ensure data fits within available bits. |
| 456 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1); |
| 457 STATIC_ASSERT(kFastCloneModeCount < 16); |
| 458 STATIC_ASSERT(kMaximumClonedLength < 16); |
449 Major MajorKey() { return FastCloneShallowArray; } | 459 Major MajorKey() { return FastCloneShallowArray; } |
450 int MinorKey() { | 460 int MinorKey() { |
451 ASSERT(mode_ >= 0 && mode_ <= LAST_CLONE_MODE); | 461 return AllocationSiteModeBits::encode(allocation_site_mode_) |
452 return length_ * kFastCloneModeCount + mode_; | 462 | ModeBits::encode(mode_) |
| 463 | LengthBits::encode(length_); |
453 } | 464 } |
454 }; | 465 }; |
455 | 466 |
456 | 467 |
457 class FastCloneShallowObjectStub : public PlatformCodeStub { | 468 class FastCloneShallowObjectStub : public PlatformCodeStub { |
458 public: | 469 public: |
459 // Maximum number of properties in copied object. | 470 // Maximum number of properties in copied object. |
460 static const int kMaximumClonedProperties = 6; | 471 static const int kMaximumClonedProperties = 6; |
461 | 472 |
462 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 473 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 | 1312 |
1302 // The current function entry hook. | 1313 // The current function entry hook. |
1303 static FunctionEntryHook entry_hook_; | 1314 static FunctionEntryHook entry_hook_; |
1304 | 1315 |
1305 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1316 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1306 }; | 1317 }; |
1307 | 1318 |
1308 } } // namespace v8::internal | 1319 } } // namespace v8::internal |
1309 | 1320 |
1310 #endif // V8_CODE_STUBS_H_ | 1321 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |