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

Side by Side Diff: src/debug/debug-evaluate.cc

Issue 2747243006: [debug] whitelist Object and Symbol builtins for debug-evaluate. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | test/debugger/debug/debug-evaluate-no-side-effect-builtins.js » ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/debug/debug-evaluate.h" 5 #include "src/debug/debug-evaluate.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/contexts.h" 9 #include "src/contexts.h"
10 #include "src/debug/debug-frames.h" 10 #include "src/debug/debug-frames.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // Literals. 308 // Literals.
309 case Runtime::kCreateArrayLiteral: 309 case Runtime::kCreateArrayLiteral:
310 case Runtime::kCreateObjectLiteral: 310 case Runtime::kCreateObjectLiteral:
311 case Runtime::kCreateRegExpLiteral: 311 case Runtime::kCreateRegExpLiteral:
312 // Misc. 312 // Misc.
313 case Runtime::kForInPrepare: 313 case Runtime::kForInPrepare:
314 case Runtime::kInlineCall: 314 case Runtime::kInlineCall:
315 case Runtime::kCall: 315 case Runtime::kCall:
316 case Runtime::kInlineMaxSmi: 316 case Runtime::kInlineMaxSmi:
317 case Runtime::kMaxSmi: 317 case Runtime::kMaxSmi:
318 case Runtime::kHasInPrototypeChain:
318 return true; 319 return true;
319 default: 320 default:
320 if (FLAG_trace_side_effect_free_debug_evaluate) { 321 if (FLAG_trace_side_effect_free_debug_evaluate) {
321 PrintF("[debug-evaluate] intrinsic %s may cause side effect.\n", 322 PrintF("[debug-evaluate] intrinsic %s may cause side effect.\n",
322 Runtime::FunctionForId(id)->name); 323 Runtime::FunctionForId(id)->name);
323 } 324 }
324 return false; 325 return false;
325 } 326 }
326 } 327 }
327 328
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Literals. 373 // Literals.
373 case Bytecode::kCreateArrayLiteral: 374 case Bytecode::kCreateArrayLiteral:
374 case Bytecode::kCreateObjectLiteral: 375 case Bytecode::kCreateObjectLiteral:
375 case Bytecode::kCreateRegExpLiteral: 376 case Bytecode::kCreateRegExpLiteral:
376 // Allocations. 377 // Allocations.
377 case Bytecode::kCreateClosure: 378 case Bytecode::kCreateClosure:
378 case Bytecode::kCreateUnmappedArguments: 379 case Bytecode::kCreateUnmappedArguments:
379 // Conversions. 380 // Conversions.
380 case Bytecode::kToObject: 381 case Bytecode::kToObject:
381 case Bytecode::kToNumber: 382 case Bytecode::kToNumber:
383 case Bytecode::kToName:
382 // Misc. 384 // Misc.
383 case Bytecode::kForInPrepare: 385 case Bytecode::kForInPrepare:
384 case Bytecode::kForInContinue: 386 case Bytecode::kForInContinue:
385 case Bytecode::kForInNext: 387 case Bytecode::kForInNext:
386 case Bytecode::kForInStep: 388 case Bytecode::kForInStep:
387 case Bytecode::kThrow: 389 case Bytecode::kThrow:
388 case Bytecode::kReThrow: 390 case Bytecode::kReThrow:
389 case Bytecode::kIllegal: 391 case Bytecode::kIllegal:
390 case Bytecode::kCallJSRuntime: 392 case Bytecode::kCallJSRuntime:
391 case Bytecode::kStackCheck: 393 case Bytecode::kStackCheck:
392 case Bytecode::kReturn: 394 case Bytecode::kReturn:
393 case Bytecode::kSetPendingMessage: 395 case Bytecode::kSetPendingMessage:
394 return true; 396 return true;
395 default: 397 default:
396 if (FLAG_trace_side_effect_free_debug_evaluate) { 398 if (FLAG_trace_side_effect_free_debug_evaluate) {
397 PrintF("[debug-evaluate] bytecode %s may cause side effect.\n", 399 PrintF("[debug-evaluate] bytecode %s may cause side effect.\n",
398 Bytecodes::ToString(bytecode)); 400 Bytecodes::ToString(bytecode));
399 } 401 }
400 return false; 402 return false;
401 } 403 }
402 } 404 }
403 405
404 bool BuiltinHasNoSideEffect(Builtins::Name id) { 406 bool BuiltinHasNoSideEffect(Builtins::Name id) {
405 switch (id) { 407 switch (id) {
406 // Whitelist for builtins. 408 // Whitelist for builtins.
407 // Object builtins. 409 // Object builtins.
410 case Builtins::kObjectCreate:
411 case Builtins::kObjectEntries:
412 case Builtins::kObjectGetOwnPropertyDescriptor:
413 case Builtins::kObjectGetOwnPropertyDescriptors:
414 case Builtins::kObjectGetOwnPropertyNames:
415 case Builtins::kObjectGetOwnPropertySymbols:
416 case Builtins::kObjectGetPrototypeOf:
417 case Builtins::kObjectIs:
418 case Builtins::kObjectIsExtensible:
419 case Builtins::kObjectIsFrozen:
420 case Builtins::kObjectIsSealed:
408 case Builtins::kObjectPrototypeValueOf: 421 case Builtins::kObjectPrototypeValueOf:
422 case Builtins::kObjectValues:
423 case Builtins::kObjectHasOwnProperty:
424 case Builtins::kObjectPrototypePropertyIsEnumerable:
425 case Builtins::kObjectProtoToString:
409 // Array builtins. 426 // Array builtins.
410 case Builtins::kArrayCode: 427 case Builtins::kArrayCode:
411 case Builtins::kArrayIndexOf: 428 case Builtins::kArrayIndexOf:
412 case Builtins::kArrayPrototypeValues: 429 case Builtins::kArrayPrototypeValues:
413 case Builtins::kArrayIncludes: 430 case Builtins::kArrayIncludes:
414 case Builtins::kArrayPrototypeEntries: 431 case Builtins::kArrayPrototypeEntries:
415 case Builtins::kArrayPrototypeKeys: 432 case Builtins::kArrayPrototypeKeys:
416 case Builtins::kArrayForEach: 433 case Builtins::kArrayForEach:
417 case Builtins::kArrayEvery: 434 case Builtins::kArrayEvery:
418 case Builtins::kArraySome: 435 case Builtins::kArraySome:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 case Builtins::kStringPrototypeStartsWith: 495 case Builtins::kStringPrototypeStartsWith:
479 case Builtins::kStringPrototypeSubstr: 496 case Builtins::kStringPrototypeSubstr:
480 case Builtins::kStringPrototypeSubstring: 497 case Builtins::kStringPrototypeSubstring:
481 case Builtins::kStringPrototypeToString: 498 case Builtins::kStringPrototypeToString:
482 case Builtins::kStringPrototypeToLowerCase: 499 case Builtins::kStringPrototypeToLowerCase:
483 case Builtins::kStringPrototypeToUpperCase: 500 case Builtins::kStringPrototypeToUpperCase:
484 case Builtins::kStringPrototypeTrim: 501 case Builtins::kStringPrototypeTrim:
485 case Builtins::kStringPrototypeTrimLeft: 502 case Builtins::kStringPrototypeTrimLeft:
486 case Builtins::kStringPrototypeTrimRight: 503 case Builtins::kStringPrototypeTrimRight:
487 case Builtins::kStringPrototypeValueOf: 504 case Builtins::kStringPrototypeValueOf:
505 // Symbol builtins.
506 case Builtins::kSymbolConstructor:
507 case Builtins::kSymbolKeyFor:
508 case Builtins::kSymbolPrototypeToString:
509 case Builtins::kSymbolPrototypeValueOf:
510 case Builtins::kSymbolPrototypeToPrimitive:
488 // JSON builtins. 511 // JSON builtins.
489 case Builtins::kJsonParse: 512 case Builtins::kJsonParse:
490 case Builtins::kJsonStringify: 513 case Builtins::kJsonStringify:
491 // Error builtins. 514 // Error builtins.
492 case Builtins::kMakeError: 515 case Builtins::kMakeError:
493 case Builtins::kMakeTypeError: 516 case Builtins::kMakeTypeError:
494 case Builtins::kMakeSyntaxError: 517 case Builtins::kMakeSyntaxError:
495 case Builtins::kMakeRangeError: 518 case Builtins::kMakeRangeError:
496 case Builtins::kMakeURIError: 519 case Builtins::kMakeURIError:
497 return true; 520 return true;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 591
569 if (FLAG_trace_side_effect_free_debug_evaluate) { 592 if (FLAG_trace_side_effect_free_debug_evaluate) {
570 PrintF("[debug-evaluate] API Callback at %p may cause side effect.\n", 593 PrintF("[debug-evaluate] API Callback at %p may cause side effect.\n",
571 reinterpret_cast<void*>(function_addr)); 594 reinterpret_cast<void*>(function_addr));
572 } 595 }
573 return false; 596 return false;
574 } 597 }
575 598
576 } // namespace internal 599 } // namespace internal
577 } // namespace v8 600 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/debugger/debug/debug-evaluate-no-side-effect-builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698