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

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

Issue 2334733002: [runtime] Intercept function declarations. (Closed)
Patch Set: Fix test. Created 4 years, 3 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/test-api-interceptors.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 { DeclarationContext context; 242 { DeclarationContext context;
243 context.Check("var x = 0; x", 243 context.Check("var x = 0; x",
244 1, // access 244 1, // access
245 1, // initialization 245 1, // initialization
246 0, EXPECT_RESULT, Number::New(CcTest::isolate(), 0)); 246 0, EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
247 } 247 }
248 248
249 { DeclarationContext context; 249 { DeclarationContext context;
250 context.Check("function x() { }; x", 250 context.Check("function x() { }; x",
251 1, // access 251 1, // access
252 0, 252 1, 1, EXPECT_RESULT);
253 0,
254 EXPECT_RESULT);
255 } 253 }
256 } 254 }
257 255
258 256
259 class AbsentPropertyContext: public DeclarationContext { 257 class AbsentPropertyContext: public DeclarationContext {
260 protected: 258 protected:
261 virtual v8::Local<Integer> Query(Local<Name> key) { 259 virtual v8::Local<Integer> Query(Local<Name> key) {
262 return v8::Local<Integer>(); 260 return v8::Local<Integer>();
263 } 261 }
264 }; 262 };
(...skipping 13 matching lines...) Expand all
278 { AbsentPropertyContext context; 276 { AbsentPropertyContext context;
279 context.Check("var x = 0; x", 277 context.Check("var x = 0; x",
280 1, // access 278 1, // access
281 1, // initialization 279 1, // initialization
282 0, EXPECT_RESULT, Number::New(isolate, 0)); 280 0, EXPECT_RESULT, Number::New(isolate, 0));
283 } 281 }
284 282
285 { AbsentPropertyContext context; 283 { AbsentPropertyContext context;
286 context.Check("function x() { }; x", 284 context.Check("function x() { }; x",
287 1, // access 285 1, // access
288 0, 286 1, 1, EXPECT_RESULT);
289 0,
290 EXPECT_RESULT);
291 } 287 }
292 288
293 { AbsentPropertyContext context; 289 { AbsentPropertyContext context;
294 context.Check("if (false) { var x = 0 }; x", 290 context.Check("if (false) { var x = 0 }; x",
295 1, // access 291 1, // access
296 0, 0, EXPECT_RESULT, Undefined(isolate)); 292 0, 0, EXPECT_RESULT, Undefined(isolate));
297 } 293 }
298 } 294 }
299 295
300 296
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 { AppearingPropertyContext context; 344 { AppearingPropertyContext context;
349 context.Check("var x = 0; x", 345 context.Check("var x = 0; x",
350 1, // access 346 1, // access
351 1, // initialization 347 1, // initialization
352 0, EXPECT_RESULT, Number::New(CcTest::isolate(), 0)); 348 0, EXPECT_RESULT, Number::New(CcTest::isolate(), 0));
353 } 349 }
354 350
355 { AppearingPropertyContext context; 351 { AppearingPropertyContext context;
356 context.Check("function x() { }; x", 352 context.Check("function x() { }; x",
357 1, // access 353 1, // access
358 0, 354 1, 1, EXPECT_RESULT);
359 0,
360 EXPECT_RESULT);
361 } 355 }
362 } 356 }
363 357
364 358
365 359
366 class ExistsInPrototypeContext: public DeclarationContext { 360 class ExistsInPrototypeContext: public DeclarationContext {
367 public: 361 public:
368 ExistsInPrototypeContext() { InitializeIfNeeded(); } 362 ExistsInPrototypeContext() { InitializeIfNeeded(); }
369 protected: 363 protected:
370 virtual v8::Local<Integer> Query(Local<Name> key) { 364 virtual v8::Local<Integer> Query(Local<Name> key) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 context.Check("var x; x", 0, 0, 0, EXPECT_RESULT, 473 context.Check("var x; x", 0, 0, 0, EXPECT_RESULT,
480 Undefined(CcTest::isolate())); 474 Undefined(CcTest::isolate()));
481 } 475 }
482 476
483 { ExistsInHiddenPrototypeContext context; 477 { ExistsInHiddenPrototypeContext context;
484 context.Check("var x = 0; x", 0, 0, 0, EXPECT_RESULT, 478 context.Check("var x = 0; x", 0, 0, 0, EXPECT_RESULT,
485 Number::New(CcTest::isolate(), 0)); 479 Number::New(CcTest::isolate(), 0));
486 } 480 }
487 481
488 { ExistsInHiddenPrototypeContext context; 482 { ExistsInHiddenPrototypeContext context;
489 context.Check("function x() { }; x", 483 context.Check("function x() { }; x", 0, 1, 1, EXPECT_RESULT);
490 0,
491 0,
492 0,
493 EXPECT_RESULT);
494 } 484 }
495 } 485 }
496 486
497 487
498 488
499 class SimpleContext { 489 class SimpleContext {
500 public: 490 public:
501 SimpleContext() 491 SimpleContext()
502 : handle_scope_(CcTest::isolate()), 492 : handle_scope_(CcTest::isolate()),
503 context_(Context::New(CcTest::isolate())) { 493 context_(Context::New(CcTest::isolate())) {
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 Undefined(CcTest::isolate())); 1167 Undefined(CcTest::isolate()));
1178 for (int i = 0; i < 4; i++) { 1168 for (int i = 0; i < 4; i++) {
1179 context.Check("f()", EXPECT_EXCEPTION); 1169 context.Check("f()", EXPECT_EXCEPTION);
1180 } 1170 }
1181 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, 1171 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT,
1182 Undefined(CcTest::isolate())); 1172 Undefined(CcTest::isolate()));
1183 1173
1184 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); 1174 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION);
1185 } 1175 }
1186 } 1176 }
OLDNEW
« no previous file with comments | « test/cctest/test-api-interceptors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698