Chromium Code Reviews| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 int MinorKey() { return slots_; } | 417 int MinorKey() { return slots_; } |
| 418 }; | 418 }; |
| 419 | 419 |
| 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_ELEMENTS_WITH_ALLOCATION_SITE_INFO, | |
|
mvstanton
2013/01/11 16:56:06
Instead, use a bitfield that combines the Allocati
mvstanton
2013/01/15 15:23:15
Done.
| |
| 427 CLONE_DOUBLE_ELEMENTS, | 428 CLONE_DOUBLE_ELEMENTS, |
| 429 CLONE_DOUBLE_ELEMENTS_WITH_ALLOCATION_SITE_INFO, | |
| 428 COPY_ON_WRITE_ELEMENTS, | 430 COPY_ON_WRITE_ELEMENTS, |
| 431 COPY_ON_WRITE_ELEMENTS_WITH_ALLOCATION_SITE_INFO, | |
| 429 CLONE_ANY_ELEMENTS, | 432 CLONE_ANY_ELEMENTS, |
| 430 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO, | 433 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO, |
| 431 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO | 434 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO |
| 432 }; | 435 }; |
| 433 | 436 |
| 434 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; | 437 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; |
| 435 | 438 |
| 436 FastCloneShallowArrayStub(Mode mode, int length) | 439 FastCloneShallowArrayStub(Mode mode, int length) |
| 437 : mode_(mode), | 440 : mode_(mode), |
| 438 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 441 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
| 439 ASSERT_GE(length_, 0); | 442 ASSERT_GE(length_, 0); |
| 440 ASSERT_LE(length_, kMaximumClonedLength); | 443 ASSERT_LE(length_, kMaximumClonedLength); |
| 441 } | 444 } |
| 442 | 445 |
| 443 void Generate(MacroAssembler* masm); | 446 void Generate(MacroAssembler* masm); |
| 444 | 447 |
| 448 static inline bool TrackAllocationSiteInfo(Mode mode) { | |
|
danno
2013/01/11 16:14:40
nit: "Track" is a command, but you use it a query.
mvstanton
2013/01/15 15:23:15
Good point, thanks. I took Toon's advice and ended
| |
| 449 return mode == CLONE_ELEMENTS_WITH_ALLOCATION_SITE_INFO || | |
| 450 mode == CLONE_DOUBLE_ELEMENTS_WITH_ALLOCATION_SITE_INFO || | |
| 451 mode == CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO || | |
| 452 mode == COPY_ON_WRITE_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
| 453 } | |
| 454 | |
| 455 static inline bool IsCloneElementsMode(Mode mode) { | |
| 456 return mode == CLONE_ELEMENTS || | |
| 457 mode == CLONE_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
| 458 } | |
| 459 | |
| 460 static inline bool IsCloneDoubleElementsMode(Mode mode) { | |
| 461 return mode == CLONE_DOUBLE_ELEMENTS || | |
| 462 mode == CLONE_DOUBLE_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
| 463 } | |
| 464 | |
| 465 static inline bool IsCopyOnWriteElementsMode(Mode mode) { | |
| 466 return mode == COPY_ON_WRITE_ELEMENTS || | |
| 467 mode == COPY_ON_WRITE_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
| 468 } | |
| 469 | |
| 470 static inline bool IsCloneAnyElementsMode(Mode mode) { | |
| 471 return mode == CLONE_ANY_ELEMENTS || | |
| 472 mode == CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO; | |
| 473 } | |
| 474 | |
| 445 private: | 475 private: |
| 446 Mode mode_; | 476 Mode mode_; |
| 447 int length_; | 477 int length_; |
| 448 | 478 |
| 449 Major MajorKey() { return FastCloneShallowArray; } | 479 Major MajorKey() { return FastCloneShallowArray; } |
| 450 int MinorKey() { | 480 int MinorKey() { |
| 451 ASSERT(mode_ >= 0 && mode_ <= LAST_CLONE_MODE); | 481 ASSERT(mode_ >= 0 && mode_ <= LAST_CLONE_MODE); |
| 452 return length_ * kFastCloneModeCount + mode_; | 482 return length_ * kFastCloneModeCount + mode_; |
| 453 } | 483 } |
| 454 }; | 484 }; |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1301 | 1331 |
| 1302 // The current function entry hook. | 1332 // The current function entry hook. |
| 1303 static FunctionEntryHook entry_hook_; | 1333 static FunctionEntryHook entry_hook_; |
| 1304 | 1334 |
| 1305 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1335 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 1306 }; | 1336 }; |
| 1307 | 1337 |
| 1308 } } // namespace v8::internal | 1338 } } // namespace v8::internal |
| 1309 | 1339 |
| 1310 #endif // V8_CODE_STUBS_H_ | 1340 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |