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

Side by Side Diff: test/cctest/test-accessors.cc

Issue 888613002: Initial switch to Chromium-style CHECK_* and DCHECK_* macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CHECK_NULL/NOT_NULL is back. Created 5 years, 10 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 | « test/cctest/compiler/value-helper.h ('k') | test/cctest/test-api.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 static int x_register[2] = {0, 0}; 144 static int x_register[2] = {0, 0};
145 static v8::Handle<v8::Object> x_receiver; 145 static v8::Handle<v8::Object> x_receiver;
146 static v8::Handle<v8::Object> x_holder; 146 static v8::Handle<v8::Object> x_holder;
147 147
148 template<class Info> 148 template<class Info>
149 static void XGetter(const Info& info, int offset) { 149 static void XGetter(const Info& info, int offset) {
150 ApiTestFuzzer::Fuzz(); 150 ApiTestFuzzer::Fuzz();
151 v8::Isolate* isolate = CcTest::isolate(); 151 v8::Isolate* isolate = CcTest::isolate();
152 CHECK_EQ(isolate, info.GetIsolate()); 152 CHECK_EQ(isolate, info.GetIsolate());
153 CHECK_EQ(x_receiver, info.This()); 153 CHECK(x_receiver->Equals(info.This()));
154 info.GetReturnValue().Set(v8_num(x_register[offset])); 154 info.GetReturnValue().Set(v8_num(x_register[offset]));
155 } 155 }
156 156
157 157
158 static void XGetter(Local<String> name, 158 static void XGetter(Local<String> name,
159 const v8::PropertyCallbackInfo<v8::Value>& info) { 159 const v8::PropertyCallbackInfo<v8::Value>& info) {
160 CHECK_EQ(x_holder, info.Holder()); 160 CHECK(x_holder->Equals(info.Holder()));
161 XGetter(info, 0); 161 XGetter(info, 0);
162 } 162 }
163 163
164 164
165 static void XGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { 165 static void XGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
166 CHECK_EQ(x_receiver, info.Holder()); 166 CHECK(x_receiver->Equals(info.Holder()));
167 XGetter(info, 1); 167 XGetter(info, 1);
168 } 168 }
169 169
170 170
171 template<class Info> 171 template<class Info>
172 static void XSetter(Local<Value> value, const Info& info, int offset) { 172 static void XSetter(Local<Value> value, const Info& info, int offset) {
173 v8::Isolate* isolate = CcTest::isolate(); 173 v8::Isolate* isolate = CcTest::isolate();
174 CHECK_EQ(isolate, info.GetIsolate()); 174 CHECK_EQ(isolate, info.GetIsolate());
175 CHECK_EQ(x_holder, info.This()); 175 CHECK(x_holder->Equals(info.This()));
176 CHECK_EQ(x_holder, info.Holder()); 176 CHECK(x_holder->Equals(info.Holder()));
177 x_register[offset] = value->Int32Value(); 177 x_register[offset] = value->Int32Value();
178 info.GetReturnValue().Set(v8_num(-1)); 178 info.GetReturnValue().Set(v8_num(-1));
179 } 179 }
180 180
181 181
182 static void XSetter(Local<String> name, 182 static void XSetter(Local<String> name,
183 Local<Value> value, 183 Local<Value> value,
184 const v8::PropertyCallbackInfo<void>& info) { 184 const v8::PropertyCallbackInfo<void>& info) {
185 XSetter(value, info, 0); 185 XSetter(value, info, 0);
186 } 186 }
(...skipping 28 matching lines...) Expand all
215 " result.push(holder.x0 = i);" 215 " result.push(holder.x0 = i);"
216 " result.push(obj.x0);" 216 " result.push(obj.x0);"
217 " result.push(holder.x1 = i + 1);" 217 " result.push(holder.x1 = i + 1);"
218 " result.push(obj.x1);" 218 " result.push(obj.x1);"
219 " result.push(holder[key_0] = i + 2);" 219 " result.push(holder[key_0] = i + 2);"
220 " result.push(obj[key_0]);" 220 " result.push(obj[key_0]);"
221 " result.push(holder[key_1] = i + 3);" 221 " result.push(holder[key_1] = i + 3);"
222 " result.push(obj[key_1]);" 222 " result.push(obj[key_1]);"
223 "}" 223 "}"
224 "result")); 224 "result"));
225 CHECK_EQ(80, array->Length()); 225 CHECK_EQ(80u, array->Length());
226 for (int i = 0; i < 80; i++) { 226 for (int i = 0; i < 80; i++) {
227 v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i)); 227 v8::Handle<Value> entry = array->Get(v8::Integer::New(isolate, i));
228 CHECK_EQ(v8::Integer::New(isolate, i/2), entry); 228 CHECK(v8::Integer::New(isolate, i / 2)->Equals(entry));
229 } 229 }
230 } 230 }
231 231
232 232
233 template <int C> 233 template <int C>
234 static void HandleAllocatingGetter( 234 static void HandleAllocatingGetter(
235 Local<String> name, 235 Local<String> name,
236 const v8::PropertyCallbackInfo<v8::Value>& info) { 236 const v8::PropertyCallbackInfo<v8::Value>& info) {
237 ApiTestFuzzer::Fuzz(); 237 ApiTestFuzzer::Fuzz();
238 for (int i = 0; i < C; i++) 238 for (int i = 0; i < C; i++)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 env->Global()->Set(v8_str("obj"), obj->NewInstance()); 400 env->Global()->Set(v8_str("obj"), obj->NewInstance());
401 401
402 // Use the throwing property setter/getter in a loop to force 402 // Use the throwing property setter/getter in a loop to force
403 // the accessor ICs to be initialized. 403 // the accessor ICs to be initialized.
404 v8::Handle<Value> result; 404 v8::Handle<Value> result;
405 result = Script::Compile(v8_str( 405 result = Script::Compile(v8_str(
406 "var result = '';" 406 "var result = '';"
407 "for (var i = 0; i < 5; i++) {" 407 "for (var i = 0; i < 5; i++) {"
408 " try { obj.x; } catch (e) { result += e; }" 408 " try { obj.x; } catch (e) { result += e; }"
409 "}; result"))->Run(); 409 "}; result"))->Run();
410 CHECK_EQ(v8_str("ggggg"), result); 410 CHECK(v8_str("ggggg")->Equals(result));
411 411
412 result = Script::Compile(String::NewFromUtf8( 412 result = Script::Compile(String::NewFromUtf8(
413 isolate, 413 isolate,
414 "var result = '';" 414 "var result = '';"
415 "for (var i = 0; i < 5; i++) {" 415 "for (var i = 0; i < 5; i++) {"
416 " try { obj.x = i; } catch (e) { result += e; }" 416 " try { obj.x = i; } catch (e) { result += e; }"
417 "}; result"))->Run(); 417 "}; result"))->Run();
418 CHECK_EQ(v8_str("01234"), result); 418 CHECK(v8_str("01234")->Equals(result));
419 } 419 }
420 420
421 421
422 static void AllocGetter(Local<String> name, 422 static void AllocGetter(Local<String> name,
423 const v8::PropertyCallbackInfo<v8::Value>& info) { 423 const v8::PropertyCallbackInfo<v8::Value>& info) {
424 ApiTestFuzzer::Fuzz(); 424 ApiTestFuzzer::Fuzz();
425 info.GetReturnValue().Set(v8::Array::New(info.GetIsolate(), 1000)); 425 info.GetReturnValue().Set(v8::Array::New(info.GetIsolate(), 1000));
426 } 426 }
427 427
428 428
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 v8::Isolate* isolate = env->GetIsolate(); 598 v8::Isolate* isolate = env->GetIsolate();
599 v8::HandleScope scope(isolate); 599 v8::HandleScope scope(isolate);
600 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate); 600 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
601 obj->SetHandler(v8::NamedPropertyHandlerConfiguration(EmptyGetter)); 601 obj->SetHandler(v8::NamedPropertyHandlerConfiguration(EmptyGetter));
602 obj->SetNativeDataProperty(v8_str("prop"), OneProperty); 602 obj->SetNativeDataProperty(v8_str("prop"), OneProperty);
603 env->Global()->Set(v8_str("obj"), obj->NewInstance()); 603 env->Global()->Set(v8_str("obj"), obj->NewInstance());
604 CompileRun( 604 CompileRun(
605 "Object.defineProperty(obj, 'prop', { writable: false });" 605 "Object.defineProperty(obj, 'prop', { writable: false });"
606 "Object.defineProperty(obj, 'prop', { writable: true });"); 606 "Object.defineProperty(obj, 'prop', { writable: true });");
607 } 607 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/value-helper.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698