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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 int slots_; | 368 int slots_; |
369 | 369 |
370 Major MajorKey() { return FastNewBlockContext; } | 370 Major MajorKey() { return FastNewBlockContext; } |
371 int MinorKey() { return slots_; } | 371 int MinorKey() { return slots_; } |
372 }; | 372 }; |
373 | 373 |
374 | 374 |
375 class FastCloneShallowArrayStub : public CodeStub { | 375 class FastCloneShallowArrayStub : public CodeStub { |
376 public: | 376 public: |
377 // Maximum length of copied elements array. | 377 // Maximum length of copied elements array. |
378 static const int kMaximumClonedLength = 8; | 378 static int MaximumClonedLength(); |
379 | 379 |
380 enum Mode { | 380 enum Mode { |
381 CLONE_ELEMENTS, | 381 CLONE_ELEMENTS, |
382 CLONE_DOUBLE_ELEMENTS, | 382 CLONE_DOUBLE_ELEMENTS, |
383 COPY_ON_WRITE_ELEMENTS, | 383 COPY_ON_WRITE_ELEMENTS, |
384 CLONE_ANY_ELEMENTS | 384 CLONE_ANY_ELEMENTS |
385 }; | 385 }; |
386 | 386 |
387 FastCloneShallowArrayStub(Mode mode, int length) | 387 FastCloneShallowArrayStub(Mode mode, int length) |
388 : mode_(mode), | 388 : mode_(mode), |
389 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 389 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
390 ASSERT_GE(length_, 0); | 390 ASSERT_GE(length_, 0); |
391 ASSERT_LE(length_, kMaximumClonedLength); | 391 ASSERT_LE(length_, MaximumClonedLength()); |
392 } | 392 } |
393 | 393 |
394 void Generate(MacroAssembler* masm); | 394 void Generate(MacroAssembler* masm); |
395 | 395 |
396 private: | 396 private: |
397 Mode mode_; | 397 Mode mode_; |
398 int length_; | 398 int length_; |
399 | 399 |
400 Major MajorKey() { return FastCloneShallowArray; } | 400 Major MajorKey() { return FastCloneShallowArray; } |
401 int MinorKey() { | 401 int MinorKey() { |
402 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); | 402 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); |
403 return length_ * 4 + mode_; | 403 return length_ * 4 + mode_; |
404 } | 404 } |
405 }; | 405 }; |
406 | 406 |
407 | 407 |
408 class FastCloneShallowObjectStub : public CodeStub { | 408 class FastCloneShallowObjectStub : public CodeStub { |
409 public: | 409 public: |
410 // Maximum number of properties in copied object. | 410 // Maximum number of properties in copied object. |
411 static const int kMaximumClonedProperties = 6; | 411 static int MaximumClonedProperties(); |
412 | 412 |
413 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 413 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
414 ASSERT_GE(length_, 0); | 414 ASSERT_GE(length_, 0); |
415 ASSERT_LE(length_, kMaximumClonedProperties); | 415 ASSERT_LE(length_, MaximumClonedProperties()); |
416 } | 416 } |
417 | 417 |
418 void Generate(MacroAssembler* masm); | 418 void Generate(MacroAssembler* masm); |
419 | 419 |
420 private: | 420 private: |
421 int length_; | 421 int length_; |
422 | 422 |
423 Major MajorKey() { return FastCloneShallowObject; } | 423 Major MajorKey() { return FastCloneShallowObject; } |
424 int MinorKey() { return length_; } | 424 int MinorKey() { return length_; } |
425 }; | 425 }; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 | 1170 |
1171 // The current function entry hook. | 1171 // The current function entry hook. |
1172 static FunctionEntryHook entry_hook_; | 1172 static FunctionEntryHook entry_hook_; |
1173 | 1173 |
1174 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1174 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1175 }; | 1175 }; |
1176 | 1176 |
1177 } } // namespace v8::internal | 1177 } } // namespace v8::internal |
1178 | 1178 |
1179 #endif // V8_CODE_STUBS_H_ | 1179 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |