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

Side by Side Diff: src/assembler.cc

Issue 12391055: Cleaned up CpuFeature scope handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nits Created 7 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/assembler.h ('k') | src/ia32/assembler-ia32.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 (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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 static Mutex* math_exp_data_mutex = NULL; 108 static Mutex* math_exp_data_mutex = NULL;
109 static double* math_exp_constants_array = NULL; 109 static double* math_exp_constants_array = NULL;
110 static double* math_exp_log_table_array = NULL; 110 static double* math_exp_log_table_array = NULL;
111 111
112 // ----------------------------------------------------------------------------- 112 // -----------------------------------------------------------------------------
113 // Implementation of AssemblerBase 113 // Implementation of AssemblerBase
114 114
115 AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size) 115 AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size)
116 : isolate_(isolate), 116 : isolate_(isolate),
117 jit_cookie_(0), 117 jit_cookie_(0),
118 enabled_cpu_features_(0),
118 emit_debug_code_(FLAG_debug_code), 119 emit_debug_code_(FLAG_debug_code),
119 predictable_code_size_(false) { 120 predictable_code_size_(false) {
120 if (FLAG_mask_constants_with_cookie && isolate != NULL) { 121 if (FLAG_mask_constants_with_cookie && isolate != NULL) {
121 jit_cookie_ = V8::RandomPrivate(isolate); 122 jit_cookie_ = V8::RandomPrivate(isolate);
122 } 123 }
123 124
124 if (buffer == NULL) { 125 if (buffer == NULL) {
125 // Do our own buffer management. 126 // Do our own buffer management.
126 if (buffer_size <= kMinimalBufferSize) { 127 if (buffer_size <= kMinimalBufferSize) {
127 buffer_size = kMinimalBufferSize; 128 buffer_size = kMinimalBufferSize;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 PredictableCodeSizeScope::~PredictableCodeSizeScope() { 174 PredictableCodeSizeScope::~PredictableCodeSizeScope() {
174 // TODO(svenpanne) Remove the 'if' when everything works. 175 // TODO(svenpanne) Remove the 'if' when everything works.
175 if (expected_size_ >= 0) { 176 if (expected_size_ >= 0) {
176 CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_); 177 CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_);
177 } 178 }
178 assembler_->set_predictable_code_size(old_value_); 179 assembler_->set_predictable_code_size(old_value_);
179 } 180 }
180 181
181 182
182 // ----------------------------------------------------------------------------- 183 // -----------------------------------------------------------------------------
184 // Implementation of CpuFeatureScope
185
186 #ifdef DEBUG
187 CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f)
188 : assembler_(assembler) {
189 ASSERT(CpuFeatures::IsSupported(f));
190 ASSERT(!Serializer::enabled() ||
191 !CpuFeatures::IsFoundByRuntimeProbingOnly(f));
192 old_enabled_ = assembler_->enabled_cpu_features();
193 uint64_t mask = static_cast<uint64_t>(1) << f;
194 // TODO(svenpanne) This special case below doesn't belong here!
195 #if V8_TARGET_ARCH_ARM
196 // VFP2 and ARMv7 are implied by VFP3.
197 if (f == VFP3) {
198 mask |=
199 static_cast<uint64_t>(1) << VFP2 |
200 static_cast<uint64_t>(1) << ARMv7;
201 }
202 #endif
203 assembler_->set_enabled_cpu_features(old_enabled_ | mask);
204 }
205
206
207 CpuFeatureScope::~CpuFeatureScope() {
208 assembler_->set_enabled_cpu_features(old_enabled_);
209 }
210 #endif
211
212
213 // -----------------------------------------------------------------------------
183 // Implementation of Label 214 // Implementation of Label
184 215
185 int Label::pos() const { 216 int Label::pos() const {
186 if (pos_ < 0) return -pos_ - 1; 217 if (pos_ < 0) return -pos_ - 1;
187 if (pos_ > 0) return pos_ - 1; 218 if (pos_ > 0) return pos_ - 1;
188 UNREACHABLE(); 219 UNREACHABLE();
189 return 0; 220 return 0;
190 } 221 }
191 222
192 223
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1639 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1609 state_.written_position = state_.current_position; 1640 state_.written_position = state_.current_position;
1610 written = true; 1641 written = true;
1611 } 1642 }
1612 1643
1613 // Return whether something was written. 1644 // Return whether something was written.
1614 return written; 1645 return written;
1615 } 1646 }
1616 1647
1617 } } // namespace v8::internal 1648 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698