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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 | 379 |
380 class FastCloneShallowArrayStub : public CodeStub { | 380 class FastCloneShallowArrayStub : public CodeStub { |
381 public: | 381 public: |
382 // Maximum length of copied elements array. | 382 // Maximum length of copied elements array. |
383 static const int kMaximumClonedLength = 8; | 383 static const int kMaximumClonedLength = 8; |
384 | 384 |
385 enum Mode { | 385 enum Mode { |
386 CLONE_ELEMENTS, | 386 CLONE_ELEMENTS, |
387 CLONE_DOUBLE_ELEMENTS, | 387 CLONE_DOUBLE_ELEMENTS, |
388 COPY_ON_WRITE_ELEMENTS, | 388 COPY_ON_WRITE_ELEMENTS, |
389 CLONE_ANY_ELEMENTS | 389 CLONE_ANY_ELEMENTS, |
390 CLONE_ANY_ELEMENTS_WITH_ALLOCATION_INFO | |
danno
2012/12/26 10:32:01
Add LAST_CLONE_MODE = CLONE_ANY_ELEMENTS_WITH_ALLO
mvstanton
2013/01/03 14:40:43
Done.
| |
390 }; | 391 }; |
391 | 392 |
392 FastCloneShallowArrayStub(Mode mode, int length) | 393 FastCloneShallowArrayStub(Mode mode, int length) |
393 : mode_(mode), | 394 : mode_(mode), |
394 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 395 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
395 ASSERT_GE(length_, 0); | 396 ASSERT_GE(length_, 0); |
396 ASSERT_LE(length_, kMaximumClonedLength); | 397 ASSERT_LE(length_, kMaximumClonedLength); |
397 } | 398 } |
398 | 399 |
399 void Generate(MacroAssembler* masm); | 400 void Generate(MacroAssembler* masm); |
400 | 401 |
401 private: | 402 private: |
402 Mode mode_; | 403 Mode mode_; |
403 int length_; | 404 int length_; |
404 | 405 |
405 Major MajorKey() { return FastCloneShallowArray; } | 406 Major MajorKey() { return FastCloneShallowArray; } |
406 int MinorKey() { | 407 int MinorKey() { |
407 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); | 408 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3 || |
danno
2012/12/26 10:32:01
While you're here, how about adding a constant
con
mvstanton
2013/01/03 14:40:43
Done.
| |
408 return length_ * 4 + mode_; | 409 mode_ == 4); |
410 return length_ * 5 + mode_; | |
danno
2012/12/26 10:32:01
return length_ * kFastCloneModeCount + mode_;
mvstanton
2013/01/03 14:40:43
Done.
| |
409 } | 411 } |
410 }; | 412 }; |
411 | 413 |
412 | 414 |
413 class FastCloneShallowObjectStub : public CodeStub { | 415 class FastCloneShallowObjectStub : public CodeStub { |
414 public: | 416 public: |
415 // Maximum number of properties in copied object. | 417 // Maximum number of properties in copied object. |
416 static const int kMaximumClonedProperties = 6; | 418 static const int kMaximumClonedProperties = 6; |
417 | 419 |
418 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 420 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1228 | 1230 |
1229 // The current function entry hook. | 1231 // The current function entry hook. |
1230 static FunctionEntryHook entry_hook_; | 1232 static FunctionEntryHook entry_hook_; |
1231 | 1233 |
1232 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1234 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1233 }; | 1235 }; |
1234 | 1236 |
1235 } } // namespace v8::internal | 1237 } } // namespace v8::internal |
1236 | 1238 |
1237 #endif // V8_CODE_STUBS_H_ | 1239 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |