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

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 825913005: Avoid MSVC's C6323 warning (use of arithmetic operator on Boolean type) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/date.cc ('k') | src/utils.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/frames-inl.h" 9 #include "src/frames-inl.h"
10 #include "src/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 HandleScope scope(isolate); 99 HandleScope scope(isolate);
100 Handle<String> name(String::cast(pairs->get(i))); 100 Handle<String> name(String::cast(pairs->get(i)));
101 Handle<Object> initial_value(pairs->get(i + 1), isolate); 101 Handle<Object> initial_value(pairs->get(i + 1), isolate);
102 102
103 // We have to declare a global const property. To capture we only 103 // We have to declare a global const property. To capture we only
104 // assign to it when evaluating the assignment for "const x = 104 // assign to it when evaluating the assignment for "const x =
105 // <expr>" the initial value is the hole. 105 // <expr>" the initial value is the hole.
106 bool is_var = initial_value->IsUndefined(); 106 bool is_var = initial_value->IsUndefined();
107 bool is_const = initial_value->IsTheHole(); 107 bool is_const = initial_value->IsTheHole();
108 bool is_function = initial_value->IsSharedFunctionInfo(); 108 bool is_function = initial_value->IsSharedFunctionInfo();
109 DCHECK(is_var + is_const + is_function == 1); 109 DCHECK_EQ(1,
110 BoolToInt(is_var) + BoolToInt(is_const) + BoolToInt(is_function));
110 111
111 Handle<Object> value; 112 Handle<Object> value;
112 if (is_function) { 113 if (is_function) {
113 // Copy the function and update its context. Use it as value. 114 // Copy the function and update its context. Use it as value.
114 Handle<SharedFunctionInfo> shared = 115 Handle<SharedFunctionInfo> shared =
115 Handle<SharedFunctionInfo>::cast(initial_value); 116 Handle<SharedFunctionInfo>::cast(initial_value);
116 Handle<JSFunction> function = 117 Handle<JSFunction> function =
117 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context, 118 isolate->factory()->NewFunctionFromSharedFunctionInfo(shared, context,
118 TENURED); 119 TENURED);
119 value = function; 120 value = function;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); 214 CONVERT_ARG_HANDLE_CHECKED(String, name, 1);
214 CONVERT_SMI_ARG_CHECKED(attr_arg, 2); 215 CONVERT_SMI_ARG_CHECKED(attr_arg, 2);
215 PropertyAttributes attr = static_cast<PropertyAttributes>(attr_arg); 216 PropertyAttributes attr = static_cast<PropertyAttributes>(attr_arg);
216 RUNTIME_ASSERT(attr == READ_ONLY || attr == NONE); 217 RUNTIME_ASSERT(attr == READ_ONLY || attr == NONE);
217 CONVERT_ARG_HANDLE_CHECKED(Object, initial_value, 3); 218 CONVERT_ARG_HANDLE_CHECKED(Object, initial_value, 3);
218 219
219 // TODO(verwaest): Unify the encoding indicating "var" with DeclareGlobals. 220 // TODO(verwaest): Unify the encoding indicating "var" with DeclareGlobals.
220 bool is_var = *initial_value == NULL; 221 bool is_var = *initial_value == NULL;
221 bool is_const = initial_value->IsTheHole(); 222 bool is_const = initial_value->IsTheHole();
222 bool is_function = initial_value->IsJSFunction(); 223 bool is_function = initial_value->IsJSFunction();
223 DCHECK(is_var + is_const + is_function == 1); 224 DCHECK_EQ(1,
225 BoolToInt(is_var) + BoolToInt(is_const) + BoolToInt(is_function));
224 226
225 int index; 227 int index;
226 PropertyAttributes attributes; 228 PropertyAttributes attributes;
227 ContextLookupFlags flags = DONT_FOLLOW_CHAINS; 229 ContextLookupFlags flags = DONT_FOLLOW_CHAINS;
228 BindingFlags binding_flags; 230 BindingFlags binding_flags;
229 Handle<Object> holder = 231 Handle<Object> holder =
230 context->Lookup(name, flags, &index, &attributes, &binding_flags); 232 context->Lookup(name, flags, &index, &attributes, &binding_flags);
231 233
232 Handle<JSObject> object; 234 Handle<JSObject> object;
233 Handle<Object> value = 235 Handle<Object> value =
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 return Smi::FromInt(frame->GetArgumentsLength()); 1081 return Smi::FromInt(frame->GetArgumentsLength());
1080 } 1082 }
1081 1083
1082 1084
1083 RUNTIME_FUNCTION(RuntimeReference_Arguments) { 1085 RUNTIME_FUNCTION(RuntimeReference_Arguments) {
1084 SealHandleScope shs(isolate); 1086 SealHandleScope shs(isolate);
1085 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1087 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1086 } 1088 }
1087 } 1089 }
1088 } // namespace v8::internal 1090 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/date.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698