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

Side by Side Diff: src/assembler.cc

Issue 446923002: Get rid of the "spare buffer" cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 enabled_cpu_features_(0), 129 enabled_cpu_features_(0),
130 emit_debug_code_(FLAG_debug_code), 130 emit_debug_code_(FLAG_debug_code),
131 predictable_code_size_(false), 131 predictable_code_size_(false),
132 // We may use the assembler without an isolate. 132 // We may use the assembler without an isolate.
133 serializer_enabled_(isolate && isolate->serializer_enabled()) { 133 serializer_enabled_(isolate && isolate->serializer_enabled()) {
134 if (FLAG_mask_constants_with_cookie && isolate != NULL) { 134 if (FLAG_mask_constants_with_cookie && isolate != NULL) {
135 jit_cookie_ = isolate->random_number_generator()->NextInt(); 135 jit_cookie_ = isolate->random_number_generator()->NextInt();
136 } 136 }
137 if (buffer == NULL) { 137 if (buffer == NULL) {
138 // Do our own buffer management. 138 // Do our own buffer management.
139 if (buffer_size <= kMinimalBufferSize) { 139 buffer = NewArray<byte>(buffer_size);
140 buffer_size = kMinimalBufferSize;
141 if (isolate->assembler_spare_buffer() != NULL) {
142 buffer = isolate->assembler_spare_buffer();
143 isolate->set_assembler_spare_buffer(NULL);
144 }
145 }
146 if (buffer == NULL) buffer = NewArray<byte>(buffer_size);
147 own_buffer_ = true; 140 own_buffer_ = true;
148 } else { 141 } else {
149 // Use externally provided buffer instead. 142 // Use externally provided buffer instead.
150 DCHECK(buffer_size > 0); 143 DCHECK(buffer_size > 0);
151 own_buffer_ = false; 144 own_buffer_ = false;
152 } 145 }
153 buffer_ = static_cast<byte*>(buffer); 146 buffer_ = static_cast<byte*>(buffer);
154 buffer_size_ = buffer_size; 147 buffer_size_ = buffer_size;
155 148
156 pc_ = buffer_; 149 pc_ = buffer_;
157 } 150 }
158 151
159 152
160 AssemblerBase::~AssemblerBase() { 153 AssemblerBase::~AssemblerBase() {
161 if (own_buffer_) { 154 if (own_buffer_) DeleteArray(buffer_);
162 if (isolate() != NULL &&
163 isolate()->assembler_spare_buffer() == NULL &&
164 buffer_size_ == kMinimalBufferSize) {
165 isolate()->set_assembler_spare_buffer(buffer_);
166 } else {
167 DeleteArray(buffer_);
168 }
169 }
170 } 155 }
171 156
172 157
173 // ----------------------------------------------------------------------------- 158 // -----------------------------------------------------------------------------
174 // Implementation of PredictableCodeSizeScope 159 // Implementation of PredictableCodeSizeScope
175 160
176 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler, 161 PredictableCodeSizeScope::PredictableCodeSizeScope(AssemblerBase* assembler,
177 int expected_size) 162 int expected_size)
178 : assembler_(assembler), 163 : assembler_(assembler),
179 expected_size_(expected_size), 164 expected_size_(expected_size),
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 r2 = r2 - ad; 1601 r2 = r2 - ad;
1617 } 1602 }
1618 delta = ad - r2; 1603 delta = ad - r2;
1619 } while (q1 < delta || (q1 == delta && r1 == 0)); 1604 } while (q1 < delta || (q1 == delta && r1 == 0));
1620 int32_t mul = static_cast<int32_t>(q2 + 1); 1605 int32_t mul = static_cast<int32_t>(q2 + 1);
1621 multiplier_ = (d < 0) ? -mul : mul; 1606 multiplier_ = (d < 0) ? -mul : mul;
1622 shift_ = p - 32; 1607 shift_ = p - 32;
1623 } 1608 }
1624 1609
1625 } } // namespace v8::internal 1610 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698