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

Side by Side Diff: src/codegen.h

Issue 3144002: Copy-on-write arrays. (Closed)
Patch Set: Review fixes. Created 10 years, 4 months 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
« no previous file with comments | « src/builtins.cc ('k') | src/heap.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 static CodeGenerator* Current() { 174 static CodeGenerator* Current() {
175 ASSERT(top_ != NULL); 175 ASSERT(top_ != NULL);
176 return top_; 176 return top_;
177 } 177 }
178 178
179 private: 179 private:
180 static CodeGenerator* top_; 180 static CodeGenerator* top_;
181 CodeGenerator* previous_; 181 CodeGenerator* previous_;
182 }; 182 };
183 183
184
184 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64 185 #if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
185 186
186 // State of used registers in a virtual frame. 187 // State of used registers in a virtual frame.
187 class FrameRegisterState { 188 class FrameRegisterState {
188 public: 189 public:
189 // Captures the current state of the given frame. 190 // Captures the current state of the given frame.
190 explicit FrameRegisterState(VirtualFrame* frame); 191 explicit FrameRegisterState(VirtualFrame* frame);
191 192
192 // Saves the state in the stack. 193 // Saves the state in the stack.
193 void Save(MacroAssembler* masm) const; 194 void Save(MacroAssembler* masm) const;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 int slots_; 389 int slots_;
389 390
390 const char* GetName() { return "FastNewContextStub"; } 391 const char* GetName() { return "FastNewContextStub"; }
391 Major MajorKey() { return FastNewContext; } 392 Major MajorKey() { return FastNewContext; }
392 int MinorKey() { return slots_; } 393 int MinorKey() { return slots_; }
393 }; 394 };
394 395
395 396
396 class FastCloneShallowArrayStub : public CodeStub { 397 class FastCloneShallowArrayStub : public CodeStub {
397 public: 398 public:
398 static const int kMaximumLength = 8; 399 // Maximum length of copied elements array.
400 static const int kMaximumClonedLength = 8;
399 401
400 explicit FastCloneShallowArrayStub(int length) : length_(length) { 402 enum Mode {
401 ASSERT(length >= 0 && length <= kMaximumLength); 403 CLONE_ELEMENTS,
404 COPY_ON_WRITE_ELEMENTS
405 };
406
407 FastCloneShallowArrayStub(Mode mode, int length)
408 : mode_(mode),
409 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
410 ASSERT(length_ >= 0);
411 ASSERT(length_ <= kMaximumClonedLength);
402 } 412 }
403 413
404 void Generate(MacroAssembler* masm); 414 void Generate(MacroAssembler* masm);
405 415
406 private: 416 private:
417 Mode mode_;
407 int length_; 418 int length_;
408 419
409 const char* GetName() { return "FastCloneShallowArrayStub"; } 420 const char* GetName() { return "FastCloneShallowArrayStub"; }
410 Major MajorKey() { return FastCloneShallowArray; } 421 Major MajorKey() { return FastCloneShallowArray; }
411 int MinorKey() { return length_; } 422 int MinorKey() {
423 ASSERT(mode_ == 0 || mode_ == 1);
424 return (length_ << 1) | mode_;
425 }
412 }; 426 };
413 427
414 428
415 class InstanceofStub: public CodeStub { 429 class InstanceofStub: public CodeStub {
416 public: 430 public:
417 InstanceofStub() { } 431 InstanceofStub() { }
418 432
419 void Generate(MacroAssembler* masm); 433 void Generate(MacroAssembler* masm);
420 434
421 private: 435 private:
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 StringCharFromCodeGenerator char_from_code_generator_; 911 StringCharFromCodeGenerator char_from_code_generator_;
898 912
899 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator); 913 DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator);
900 }; 914 };
901 915
902 916
903 } // namespace internal 917 } // namespace internal
904 } // namespace v8 918 } // namespace v8
905 919
906 #endif // V8_CODEGEN_H_ 920 #endif // V8_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698