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

Side by Side Diff: src/virtual-frame.cc

Issue 115347: Reduce the memory used by frame elements from two words to one by... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // We do not allow copies of copies, so we follow one link to 87 // We do not allow copies of copies, so we follow one link to
88 // the actual backing store of a copy before making a copy. 88 // the actual backing store of a copy before making a copy.
89 index = target.index(); 89 index = target.index();
90 ASSERT(elements_[index].is_memory() || elements_[index].is_register()); 90 ASSERT(elements_[index].is_memory() || elements_[index].is_register());
91 // Fall through. 91 // Fall through.
92 92
93 case FrameElement::MEMORY: // Fall through. 93 case FrameElement::MEMORY: // Fall through.
94 case FrameElement::REGISTER: 94 case FrameElement::REGISTER:
95 // All copies are backed by memory or register locations. 95 // All copies are backed by memory or register locations.
96 result.set_static_type(target.static_type()); 96 result.set_static_type(target.static_type());
97 result.type_ = FrameElement::COPY; 97 result.set_type(FrameElement::COPY);
98 result.copied_ = false; 98 result.clear_copied();
99 result.synced_ = false; 99 result.clear_sync();
100 result.data_.index_ = index; 100 result.set_index(index);
101 elements_[index].set_copied(); 101 elements_[index].set_copied();
102 break; 102 break;
103 103
104 case FrameElement::INVALID: 104 case FrameElement::INVALID:
105 // We should not try to copy invalid elements. 105 // We should not try to copy invalid elements.
106 UNREACHABLE(); 106 UNREACHABLE();
107 break; 107 break;
108 } 108 }
109 return result; 109 return result;
110 } 110 }
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 ASSERT(num_dropped >= 0); 458 ASSERT(num_dropped >= 0);
459 if (num_dropped == 0) return; 459 if (num_dropped == 0) return;
460 Result tos = Pop(); 460 Result tos = Pop();
461 if (num_dropped > 1) { 461 if (num_dropped > 1) {
462 Drop(num_dropped - 1); 462 Drop(num_dropped - 1);
463 } 463 }
464 SetElementAt(0, &tos); 464 SetElementAt(0, &tos);
465 } 465 }
466 466
467 467
468 bool FrameElement::Equals(FrameElement other) {
469 if (type_ != other.type_ ||
470 copied_ != other.copied_ ||
471 synced_ != other.synced_) return false;
472
473 if (is_register()) {
474 if (!reg().is(other.reg())) return false;
475 } else if (is_constant()) {
476 if (!handle().is_identical_to(other.handle())) return false;
477 } else if (is_copy()) {
478 if (index() != other.index()) return false;
479 }
480
481 return true;
482 }
483
484
485 bool VirtualFrame::Equals(VirtualFrame* other) { 468 bool VirtualFrame::Equals(VirtualFrame* other) {
486 #ifdef DEBUG 469 #ifdef DEBUG
487 // These are sanity checks in debug builds, but we do not need to 470 // These are sanity checks in debug builds, but we do not need to
488 // use them to distinguish frames at merge points. 471 // use them to distinguish frames at merge points.
489 if (cgen_ != other->cgen_) return false; 472 if (cgen_ != other->cgen_) return false;
490 if (masm_ != other->masm_) return false; 473 if (masm_ != other->masm_) return false;
491 if (parameter_count_ != other->parameter_count_) return false; 474 if (parameter_count_ != other->parameter_count_) return false;
492 if (local_count_ != other->local_count_) return false; 475 if (local_count_ != other->local_count_) return false;
493 if (frame_pointer_ != other->frame_pointer_) return false; 476 if (frame_pointer_ != other->frame_pointer_) return false;
494 477
(...skipping 16 matching lines...) Expand all
511 // Specialization of List::ResizeAdd to non-inlined version for FrameElements. 494 // Specialization of List::ResizeAdd to non-inlined version for FrameElements.
512 // The function ResizeAdd becomes a real function, whose implementation is the 495 // The function ResizeAdd becomes a real function, whose implementation is the
513 // inlined ResizeAddInternal. 496 // inlined ResizeAddInternal.
514 template <> 497 template <>
515 void List<FrameElement, 498 void List<FrameElement,
516 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) { 499 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) {
517 ResizeAddInternal(element); 500 ResizeAddInternal(element);
518 } 501 }
519 502
520 } } // namespace v8::internal 503 } } // namespace v8::internal
OLDNEW
« src/virtual-frame.h ('K') | « src/virtual-frame.h ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698