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

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

Issue 1207006: Rename NumberInfo to TypeInfo.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: changed project files Created 10 years, 9 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
« no previous file with comments | « src/type-info-inl.h ('k') | src/virtual-frame-inl.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 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 25 matching lines...) Expand all
36 36
37 // ------------------------------------------------------------------------- 37 // -------------------------------------------------------------------------
38 // VirtualFrame implementation. 38 // VirtualFrame implementation.
39 39
40 // Create a duplicate of an existing valid frame element. 40 // Create a duplicate of an existing valid frame element.
41 // We can pass an optional number type information that will override the 41 // We can pass an optional number type information that will override the
42 // existing information about the backing element. The new information must 42 // existing information about the backing element. The new information must
43 // not conflict with the existing type information and must be equally or 43 // not conflict with the existing type information and must be equally or
44 // more precise. The default parameter value kUninitialized means that there 44 // more precise. The default parameter value kUninitialized means that there
45 // is no additional information. 45 // is no additional information.
46 FrameElement VirtualFrame::CopyElementAt(int index, NumberInfo info) { 46 FrameElement VirtualFrame::CopyElementAt(int index, TypeInfo info) {
47 ASSERT(index >= 0); 47 ASSERT(index >= 0);
48 ASSERT(index < element_count()); 48 ASSERT(index < element_count());
49 49
50 FrameElement target = elements_[index]; 50 FrameElement target = elements_[index];
51 FrameElement result; 51 FrameElement result;
52 52
53 switch (target.type()) { 53 switch (target.type()) {
54 case FrameElement::CONSTANT: 54 case FrameElement::CONSTANT:
55 // We do not copy constants and instead return a fresh unsynced 55 // We do not copy constants and instead return a fresh unsynced
56 // constant. 56 // constant.
(...skipping 10 matching lines...) Expand all
67 67
68 case FrameElement::MEMORY: // Fall through. 68 case FrameElement::MEMORY: // Fall through.
69 case FrameElement::REGISTER: { 69 case FrameElement::REGISTER: {
70 // All copies are backed by memory or register locations. 70 // All copies are backed by memory or register locations.
71 result.set_type(FrameElement::COPY); 71 result.set_type(FrameElement::COPY);
72 result.clear_copied(); 72 result.clear_copied();
73 result.clear_sync(); 73 result.clear_sync();
74 result.set_index(index); 74 result.set_index(index);
75 elements_[index].set_copied(); 75 elements_[index].set_copied();
76 // Update backing element's number information. 76 // Update backing element's number information.
77 NumberInfo existing = elements_[index].number_info(); 77 TypeInfo existing = elements_[index].type_info();
78 ASSERT(!existing.IsUninitialized()); 78 ASSERT(!existing.IsUninitialized());
79 // Assert that the new type information (a) does not conflict with the 79 // Assert that the new type information (a) does not conflict with the
80 // existing one and (b) is equally or more precise. 80 // existing one and (b) is equally or more precise.
81 ASSERT((info.ToInt() & existing.ToInt()) == existing.ToInt()); 81 ASSERT((info.ToInt() & existing.ToInt()) == existing.ToInt());
82 ASSERT((info.ToInt() | existing.ToInt()) == info.ToInt()); 82 ASSERT((info.ToInt() | existing.ToInt()) == info.ToInt());
83 83
84 elements_[index].set_number_info(!info.IsUninitialized() 84 elements_[index].set_type_info(!info.IsUninitialized()
85 ? info 85 ? info
86 : existing); 86 : existing);
87 break; 87 break;
88 } 88 }
89 case FrameElement::INVALID: 89 case FrameElement::INVALID:
90 // We should not try to copy invalid elements. 90 // We should not try to copy invalid elements.
91 UNREACHABLE(); 91 UNREACHABLE();
92 break; 92 break;
93 } 93 }
94 return result; 94 return result;
95 } 95 }
96 96
97 97
98 // Modify the state of the virtual frame to match the actual frame by adding 98 // Modify the state of the virtual frame to match the actual frame by adding
99 // extra in-memory elements to the top of the virtual frame. The extra 99 // extra in-memory elements to the top of the virtual frame. The extra
100 // elements will be externally materialized on the actual frame (eg, by 100 // elements will be externally materialized on the actual frame (eg, by
101 // pushing an exception handler). No code is emitted. 101 // pushing an exception handler). No code is emitted.
102 void VirtualFrame::Adjust(int count) { 102 void VirtualFrame::Adjust(int count) {
103 ASSERT(count >= 0); 103 ASSERT(count >= 0);
104 ASSERT(stack_pointer_ == element_count() - 1); 104 ASSERT(stack_pointer_ == element_count() - 1);
105 105
106 for (int i = 0; i < count; i++) { 106 for (int i = 0; i < count; i++) {
107 elements_.Add(FrameElement::MemoryElement(NumberInfo::Unknown())); 107 elements_.Add(FrameElement::MemoryElement(TypeInfo::Unknown()));
108 } 108 }
109 stack_pointer_ += count; 109 stack_pointer_ += count;
110 } 110 }
111 111
112 112
113 void VirtualFrame::ForgetElements(int count) { 113 void VirtualFrame::ForgetElements(int count) {
114 ASSERT(count >= 0); 114 ASSERT(count >= 0);
115 ASSERT(element_count() >= count); 115 ASSERT(element_count() >= count);
116 116
117 for (int i = 0; i < count; i++) { 117 for (int i = 0; i < count; i++) {
(...skipping 27 matching lines...) Expand all
145 } 145 }
146 146
147 147
148 // Make the type of the element at a given index be MEMORY. 148 // Make the type of the element at a given index be MEMORY.
149 void VirtualFrame::SpillElementAt(int index) { 149 void VirtualFrame::SpillElementAt(int index) {
150 if (!elements_[index].is_valid()) return; 150 if (!elements_[index].is_valid()) return;
151 151
152 SyncElementAt(index); 152 SyncElementAt(index);
153 // Number type information is preserved. 153 // Number type information is preserved.
154 // Copies get their number information from their backing element. 154 // Copies get their number information from their backing element.
155 NumberInfo info; 155 TypeInfo info;
156 if (!elements_[index].is_copy()) { 156 if (!elements_[index].is_copy()) {
157 info = elements_[index].number_info(); 157 info = elements_[index].type_info();
158 } else { 158 } else {
159 info = elements_[elements_[index].index()].number_info(); 159 info = elements_[elements_[index].index()].type_info();
160 } 160 }
161 // The element is now in memory. Its copied flag is preserved. 161 // The element is now in memory. Its copied flag is preserved.
162 FrameElement new_element = FrameElement::MemoryElement(info); 162 FrameElement new_element = FrameElement::MemoryElement(info);
163 if (elements_[index].is_copied()) { 163 if (elements_[index].is_copied()) {
164 new_element.set_copied(); 164 new_element.set_copied();
165 } 165 }
166 if (elements_[index].is_untagged_int32()) { 166 if (elements_[index].is_untagged_int32()) {
167 new_element.set_untagged_int32(true); 167 new_element.set_untagged_int32(true);
168 } 168 }
169 if (elements_[index].is_register()) { 169 if (elements_[index].is_register()) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 elements_[j].set_index(frame_index); 311 elements_[j].set_index(frame_index);
312 } 312 }
313 } 313 }
314 } 314 }
315 } else { 315 } else {
316 // The register value->reg() was not already used on the frame. 316 // The register value->reg() was not already used on the frame.
317 Use(value->reg(), frame_index); 317 Use(value->reg(), frame_index);
318 elements_[frame_index] = 318 elements_[frame_index] =
319 FrameElement::RegisterElement(value->reg(), 319 FrameElement::RegisterElement(value->reg(),
320 FrameElement::NOT_SYNCED, 320 FrameElement::NOT_SYNCED,
321 value->number_info()); 321 value->type_info());
322 } 322 }
323 } else { 323 } else {
324 ASSERT(value->is_constant()); 324 ASSERT(value->is_constant());
325 elements_[frame_index] = 325 elements_[frame_index] =
326 FrameElement::ConstantElement(value->handle(), 326 FrameElement::ConstantElement(value->handle(),
327 FrameElement::NOT_SYNCED); 327 FrameElement::NOT_SYNCED);
328 } 328 }
329 value->Unuse(); 329 value->Unuse();
330 } 330 }
331 331
332 332
333 // Specialization of List::ResizeAdd to non-inlined version for FrameElements. 333 // Specialization of List::ResizeAdd to non-inlined version for FrameElements.
334 // The function ResizeAdd becomes a real function, whose implementation is the 334 // The function ResizeAdd becomes a real function, whose implementation is the
335 // inlined ResizeAddInternal. 335 // inlined ResizeAddInternal.
336 template <> 336 template <>
337 void List<FrameElement, 337 void List<FrameElement,
338 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) { 338 FreeStoreAllocationPolicy>::ResizeAdd(const FrameElement& element) {
339 ResizeAddInternal(element); 339 ResizeAddInternal(element);
340 } 340 }
341 341
342 } } // namespace v8::internal 342 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info-inl.h ('k') | src/virtual-frame-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698