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

Side by Side Diff: src/flags.cc

Issue 430503007: Rename ASSERT* to DCHECK*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE and fixes 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
« no previous file with comments | « src/flag-definitions.h ('k') | src/frames.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <ctype.h> 5 #include <ctype.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 27 matching lines...) Expand all
38 const char* cmt_; // A comment about the flags purpose. 38 const char* cmt_; // A comment about the flags purpose.
39 bool owns_ptr_; // Does the flag own its string value? 39 bool owns_ptr_; // Does the flag own its string value?
40 40
41 FlagType type() const { return type_; } 41 FlagType type() const { return type_; }
42 42
43 const char* name() const { return name_; } 43 const char* name() const { return name_; }
44 44
45 const char* comment() const { return cmt_; } 45 const char* comment() const { return cmt_; }
46 46
47 bool* bool_variable() const { 47 bool* bool_variable() const {
48 ASSERT(type_ == TYPE_BOOL); 48 DCHECK(type_ == TYPE_BOOL);
49 return reinterpret_cast<bool*>(valptr_); 49 return reinterpret_cast<bool*>(valptr_);
50 } 50 }
51 51
52 MaybeBoolFlag* maybe_bool_variable() const { 52 MaybeBoolFlag* maybe_bool_variable() const {
53 ASSERT(type_ == TYPE_MAYBE_BOOL); 53 DCHECK(type_ == TYPE_MAYBE_BOOL);
54 return reinterpret_cast<MaybeBoolFlag*>(valptr_); 54 return reinterpret_cast<MaybeBoolFlag*>(valptr_);
55 } 55 }
56 56
57 int* int_variable() const { 57 int* int_variable() const {
58 ASSERT(type_ == TYPE_INT); 58 DCHECK(type_ == TYPE_INT);
59 return reinterpret_cast<int*>(valptr_); 59 return reinterpret_cast<int*>(valptr_);
60 } 60 }
61 61
62 double* float_variable() const { 62 double* float_variable() const {
63 ASSERT(type_ == TYPE_FLOAT); 63 DCHECK(type_ == TYPE_FLOAT);
64 return reinterpret_cast<double*>(valptr_); 64 return reinterpret_cast<double*>(valptr_);
65 } 65 }
66 66
67 const char* string_value() const { 67 const char* string_value() const {
68 ASSERT(type_ == TYPE_STRING); 68 DCHECK(type_ == TYPE_STRING);
69 return *reinterpret_cast<const char**>(valptr_); 69 return *reinterpret_cast<const char**>(valptr_);
70 } 70 }
71 71
72 void set_string_value(const char* value, bool owns_ptr) { 72 void set_string_value(const char* value, bool owns_ptr) {
73 ASSERT(type_ == TYPE_STRING); 73 DCHECK(type_ == TYPE_STRING);
74 const char** ptr = reinterpret_cast<const char**>(valptr_); 74 const char** ptr = reinterpret_cast<const char**>(valptr_);
75 if (owns_ptr_ && *ptr != NULL) DeleteArray(*ptr); 75 if (owns_ptr_ && *ptr != NULL) DeleteArray(*ptr);
76 *ptr = value; 76 *ptr = value;
77 owns_ptr_ = owns_ptr; 77 owns_ptr_ = owns_ptr;
78 } 78 }
79 79
80 JSArguments* args_variable() const { 80 JSArguments* args_variable() const {
81 ASSERT(type_ == TYPE_ARGS); 81 DCHECK(type_ == TYPE_ARGS);
82 return reinterpret_cast<JSArguments*>(valptr_); 82 return reinterpret_cast<JSArguments*>(valptr_);
83 } 83 }
84 84
85 bool bool_default() const { 85 bool bool_default() const {
86 ASSERT(type_ == TYPE_BOOL); 86 DCHECK(type_ == TYPE_BOOL);
87 return *reinterpret_cast<const bool*>(defptr_); 87 return *reinterpret_cast<const bool*>(defptr_);
88 } 88 }
89 89
90 int int_default() const { 90 int int_default() const {
91 ASSERT(type_ == TYPE_INT); 91 DCHECK(type_ == TYPE_INT);
92 return *reinterpret_cast<const int*>(defptr_); 92 return *reinterpret_cast<const int*>(defptr_);
93 } 93 }
94 94
95 double float_default() const { 95 double float_default() const {
96 ASSERT(type_ == TYPE_FLOAT); 96 DCHECK(type_ == TYPE_FLOAT);
97 return *reinterpret_cast<const double*>(defptr_); 97 return *reinterpret_cast<const double*>(defptr_);
98 } 98 }
99 99
100 const char* string_default() const { 100 const char* string_default() const {
101 ASSERT(type_ == TYPE_STRING); 101 DCHECK(type_ == TYPE_STRING);
102 return *reinterpret_cast<const char* const *>(defptr_); 102 return *reinterpret_cast<const char* const *>(defptr_);
103 } 103 }
104 104
105 JSArguments args_default() const { 105 JSArguments args_default() const {
106 ASSERT(type_ == TYPE_ARGS); 106 DCHECK(type_ == TYPE_ARGS);
107 return *reinterpret_cast<const JSArguments*>(defptr_); 107 return *reinterpret_cast<const JSArguments*>(defptr_);
108 } 108 }
109 109
110 // Compare this flag's current value against the default. 110 // Compare this flag's current value against the default.
111 bool IsDefault() const { 111 bool IsDefault() const {
112 switch (type_) { 112 switch (type_) {
113 case TYPE_BOOL: 113 case TYPE_BOOL:
114 return *bool_variable() == bool_default(); 114 return *bool_variable() == bool_default();
115 case TYPE_MAYBE_BOOL: 115 case TYPE_MAYBE_BOOL:
116 return maybe_bool_variable()->has_value == false; 116 return maybe_bool_variable()->has_value == false;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 219
220 // static 220 // static
221 List<const char*>* FlagList::argv() { 221 List<const char*>* FlagList::argv() {
222 List<const char*>* args = new List<const char*>(8); 222 List<const char*>* args = new List<const char*>(8);
223 Flag* args_flag = NULL; 223 Flag* args_flag = NULL;
224 for (size_t i = 0; i < num_flags; ++i) { 224 for (size_t i = 0; i < num_flags; ++i) {
225 Flag* f = &flags[i]; 225 Flag* f = &flags[i];
226 if (!f->IsDefault()) { 226 if (!f->IsDefault()) {
227 if (f->type() == Flag::TYPE_ARGS) { 227 if (f->type() == Flag::TYPE_ARGS) {
228 ASSERT(args_flag == NULL); 228 DCHECK(args_flag == NULL);
229 args_flag = f; // Must be last in arguments. 229 args_flag = f; // Must be last in arguments.
230 continue; 230 continue;
231 } 231 }
232 { 232 {
233 bool disabled = f->type() == Flag::TYPE_BOOL && !*f->bool_variable(); 233 bool disabled = f->type() == Flag::TYPE_BOOL && !*f->bool_variable();
234 OStringStream os; 234 OStringStream os;
235 os << (disabled ? "--no" : "--") << f->name(); 235 os << (disabled ? "--no" : "--") << f->name();
236 args->Add(StrDup(os.c_str())); 236 args->Add(StrDup(os.c_str()));
237 } 237 }
238 if (f->type() != Flag::TYPE_BOOL) { 238 if (f->type() != Flag::TYPE_BOOL) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 542
543 // static 543 // static
544 void FlagList::EnforceFlagImplications() { 544 void FlagList::EnforceFlagImplications() {
545 #define FLAG_MODE_DEFINE_IMPLICATIONS 545 #define FLAG_MODE_DEFINE_IMPLICATIONS
546 #include "src/flag-definitions.h" 546 #include "src/flag-definitions.h"
547 #undef FLAG_MODE_DEFINE_IMPLICATIONS 547 #undef FLAG_MODE_DEFINE_IMPLICATIONS
548 } 548 }
549 549
550 } } // namespace v8::internal 550 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698