Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: src/code-stubs.h

Issue 8598014: Implement code stub for object literal creation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Florian Schneider. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 V(RegExpExec) \ 51 V(RegExpExec) \
52 V(TranscendentalCache) \ 52 V(TranscendentalCache) \
53 V(Instanceof) \ 53 V(Instanceof) \
54 V(ConvertToDouble) \ 54 V(ConvertToDouble) \
55 V(WriteInt32ToHeapNumber) \ 55 V(WriteInt32ToHeapNumber) \
56 V(StackCheck) \ 56 V(StackCheck) \
57 V(FastNewClosure) \ 57 V(FastNewClosure) \
58 V(FastNewContext) \ 58 V(FastNewContext) \
59 V(FastNewBlockContext) \ 59 V(FastNewBlockContext) \
60 V(FastCloneShallowArray) \ 60 V(FastCloneShallowArray) \
61 V(FastCloneShallowObject) \
61 V(ToBoolean) \ 62 V(ToBoolean) \
62 V(ToNumber) \ 63 V(ToNumber) \
63 V(ArgumentsAccess) \ 64 V(ArgumentsAccess) \
64 V(RegExpConstructResult) \ 65 V(RegExpConstructResult) \
65 V(NumberToString) \ 66 V(NumberToString) \
66 V(CEntry) \ 67 V(CEntry) \
67 V(JSEntry) \ 68 V(JSEntry) \
68 V(KeyedLoadElement) \ 69 V(KeyedLoadElement) \
69 V(KeyedStoreElement) \ 70 V(KeyedStoreElement) \
70 V(DebuggerStatement) \ 71 V(DebuggerStatement) \
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 enum Mode { 356 enum Mode {
356 CLONE_ELEMENTS, 357 CLONE_ELEMENTS,
357 CLONE_DOUBLE_ELEMENTS, 358 CLONE_DOUBLE_ELEMENTS,
358 COPY_ON_WRITE_ELEMENTS, 359 COPY_ON_WRITE_ELEMENTS,
359 CLONE_ANY_ELEMENTS 360 CLONE_ANY_ELEMENTS
360 }; 361 };
361 362
362 FastCloneShallowArrayStub(Mode mode, int length) 363 FastCloneShallowArrayStub(Mode mode, int length)
363 : mode_(mode), 364 : mode_(mode),
364 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { 365 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
365 ASSERT(length_ >= 0); 366 ASSERT_GE(length_, 0);
366 ASSERT(length_ <= kMaximumClonedLength); 367 ASSERT_LE(length_, kMaximumClonedLength);
367 } 368 }
368 369
369 void Generate(MacroAssembler* masm); 370 void Generate(MacroAssembler* masm);
370 371
371 private: 372 private:
372 Mode mode_; 373 Mode mode_;
373 int length_; 374 int length_;
374 375
375 Major MajorKey() { return FastCloneShallowArray; } 376 Major MajorKey() { return FastCloneShallowArray; }
376 int MinorKey() { 377 int MinorKey() {
377 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3); 378 ASSERT(mode_ == 0 || mode_ == 1 || mode_ == 2 || mode_ == 3);
378 return length_ * 4 + mode_; 379 return length_ * 4 + mode_;
379 } 380 }
380 }; 381 };
381 382
382 383
384 class FastCloneShallowObjectStub : public CodeStub {
385 public:
386 // Maximum number of properties in copied object.
387 static const int kMaximumClonedProperties = 6;
388
389 FastCloneShallowObjectStub(int length) : length_(length) {
390 ASSERT_GE(length_, 0);
391 ASSERT_LE(length_, kMaximumClonedProperties);
392 }
393
394 void Generate(MacroAssembler* masm);
395
396 private:
397 int length_;
398
399 Major MajorKey() { return FastCloneShallowObject; }
400 int MinorKey() { return length_; }
401 };
402
403
383 class InstanceofStub: public CodeStub { 404 class InstanceofStub: public CodeStub {
384 public: 405 public:
385 enum Flags { 406 enum Flags {
386 kNoFlags = 0, 407 kNoFlags = 0,
387 kArgsInRegisters = 1 << 0, 408 kArgsInRegisters = 1 << 0,
388 kCallSiteInlineCheck = 1 << 1, 409 kCallSiteInlineCheck = 1 << 1,
389 kReturnTrueFalseObject = 1 << 2 410 kReturnTrueFalseObject = 1 << 2
390 }; 411 };
391 412
392 explicit InstanceofStub(Flags flags) : flags_(flags) { } 413 explicit InstanceofStub(Flags flags) : flags_(flags) { }
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 int MinorKey() { return 0; } 1084 int MinorKey() { return 0; }
1064 1085
1065 void Generate(MacroAssembler* masm); 1086 void Generate(MacroAssembler* masm);
1066 1087
1067 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1088 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1068 }; 1089 };
1069 1090
1070 } } // namespace v8::internal 1091 } } // namespace v8::internal
1071 1092
1072 #endif // V8_CODE_STUBS_H_ 1093 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698