OLD | NEW |
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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // Whitelist for intrinsics amd runtime functions. | 264 // Whitelist for intrinsics amd runtime functions. |
265 // Conversions. | 265 // Conversions. |
266 case Runtime::kToInteger: | 266 case Runtime::kToInteger: |
267 case Runtime::kInlineToInteger: | 267 case Runtime::kInlineToInteger: |
268 case Runtime::kToObject: | 268 case Runtime::kToObject: |
269 case Runtime::kInlineToObject: | 269 case Runtime::kInlineToObject: |
270 case Runtime::kToString: | 270 case Runtime::kToString: |
271 case Runtime::kInlineToString: | 271 case Runtime::kInlineToString: |
272 case Runtime::kToLength: | 272 case Runtime::kToLength: |
273 case Runtime::kInlineToLength: | 273 case Runtime::kInlineToLength: |
| 274 case Runtime::kToNumber: |
274 // Type checks. | 275 // Type checks. |
275 case Runtime::kIsJSReceiver: | 276 case Runtime::kIsJSReceiver: |
276 case Runtime::kInlineIsJSReceiver: | 277 case Runtime::kInlineIsJSReceiver: |
277 case Runtime::kIsSmi: | 278 case Runtime::kIsSmi: |
278 case Runtime::kInlineIsSmi: | 279 case Runtime::kInlineIsSmi: |
279 case Runtime::kIsArray: | 280 case Runtime::kIsArray: |
| 281 case Runtime::kInlineIsArray: |
280 case Runtime::kIsFunction: | 282 case Runtime::kIsFunction: |
281 case Runtime::kIsDate: | 283 case Runtime::kIsDate: |
282 case Runtime::kIsJSProxy: | 284 case Runtime::kIsJSProxy: |
283 case Runtime::kIsRegExp: | 285 case Runtime::kIsRegExp: |
284 case Runtime::kIsTypedArray: | 286 case Runtime::kIsTypedArray: |
285 // Loads. | 287 // Loads. |
286 case Runtime::kLoadLookupSlotForCall: | 288 case Runtime::kLoadLookupSlotForCall: |
| 289 // Arrays. |
| 290 case Runtime::kArraySpeciesConstructor: |
| 291 case Runtime::kNormalizeElements: |
| 292 case Runtime::kGetArrayKeys: |
| 293 case Runtime::kHasComplexElements: |
| 294 case Runtime::kEstimateNumberOfElements: |
287 // Errors. | 295 // Errors. |
288 case Runtime::kReThrow: | 296 case Runtime::kReThrow: |
289 case Runtime::kThrowReferenceError: | 297 case Runtime::kThrowReferenceError: |
290 case Runtime::kThrowSymbolIteratorInvalid: | 298 case Runtime::kThrowSymbolIteratorInvalid: |
291 case Runtime::kThrowIteratorResultNotAnObject: | 299 case Runtime::kThrowIteratorResultNotAnObject: |
292 case Runtime::kNewTypeError: | 300 case Runtime::kNewTypeError: |
293 // Strings. | 301 // Strings. |
294 case Runtime::kInlineStringCharCodeAt: | 302 case Runtime::kInlineStringCharCodeAt: |
295 case Runtime::kStringCharCodeAt: | 303 case Runtime::kStringCharCodeAt: |
296 case Runtime::kStringIndexOf: | 304 case Runtime::kStringIndexOf: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 case Bytecode::kCreateWithContext: | 372 case Bytecode::kCreateWithContext: |
365 // Literals. | 373 // Literals. |
366 case Bytecode::kCreateArrayLiteral: | 374 case Bytecode::kCreateArrayLiteral: |
367 case Bytecode::kCreateObjectLiteral: | 375 case Bytecode::kCreateObjectLiteral: |
368 case Bytecode::kCreateRegExpLiteral: | 376 case Bytecode::kCreateRegExpLiteral: |
369 // Allocations. | 377 // Allocations. |
370 case Bytecode::kCreateClosure: | 378 case Bytecode::kCreateClosure: |
371 case Bytecode::kCreateUnmappedArguments: | 379 case Bytecode::kCreateUnmappedArguments: |
372 // Conversions. | 380 // Conversions. |
373 case Bytecode::kToObject: | 381 case Bytecode::kToObject: |
| 382 case Bytecode::kToNumber: |
374 // Misc. | 383 // Misc. |
375 case Bytecode::kForInPrepare: | 384 case Bytecode::kForInPrepare: |
376 case Bytecode::kForInContinue: | 385 case Bytecode::kForInContinue: |
377 case Bytecode::kForInNext: | 386 case Bytecode::kForInNext: |
378 case Bytecode::kForInStep: | 387 case Bytecode::kForInStep: |
379 case Bytecode::kThrow: | 388 case Bytecode::kThrow: |
380 case Bytecode::kReThrow: | 389 case Bytecode::kReThrow: |
381 case Bytecode::kIllegal: | 390 case Bytecode::kIllegal: |
382 case Bytecode::kCallJSRuntime: | 391 case Bytecode::kCallJSRuntime: |
383 case Bytecode::kStackCheck: | 392 case Bytecode::kStackCheck: |
384 case Bytecode::kReturn: | 393 case Bytecode::kReturn: |
385 case Bytecode::kSetPendingMessage: | 394 case Bytecode::kSetPendingMessage: |
386 return true; | 395 return true; |
387 default: | 396 default: |
388 if (FLAG_trace_side_effect_free_debug_evaluate) { | 397 if (FLAG_trace_side_effect_free_debug_evaluate) { |
389 PrintF("[debug-evaluate] bytecode %s may cause side effect.\n", | 398 PrintF("[debug-evaluate] bytecode %s may cause side effect.\n", |
390 Bytecodes::ToString(bytecode)); | 399 Bytecodes::ToString(bytecode)); |
391 } | 400 } |
392 return false; | 401 return false; |
393 } | 402 } |
394 } | 403 } |
395 | 404 |
396 bool BuiltinHasNoSideEffect(Builtins::Name id) { | 405 bool BuiltinHasNoSideEffect(Builtins::Name id) { |
397 switch (id) { | 406 switch (id) { |
398 // Whitelist for builtins. | 407 // Whitelist for builtins. |
399 // Array builtins. | 408 // Array builtins. |
| 409 case Builtins::kArrayCode: |
| 410 case Builtins::kArrayIndexOf: |
400 case Builtins::kArrayPrototypeValues: | 411 case Builtins::kArrayPrototypeValues: |
| 412 case Builtins::kArrayIncludes: |
| 413 case Builtins::kArrayPrototypeEntries: |
| 414 case Builtins::kArrayPrototypeKeys: |
| 415 case Builtins::kArrayForEach: |
401 // Math builtins. | 416 // Math builtins. |
402 case Builtins::kMathAbs: | 417 case Builtins::kMathAbs: |
403 case Builtins::kMathAcos: | 418 case Builtins::kMathAcos: |
404 case Builtins::kMathAcosh: | 419 case Builtins::kMathAcosh: |
405 case Builtins::kMathAsin: | 420 case Builtins::kMathAsin: |
406 case Builtins::kMathAsinh: | 421 case Builtins::kMathAsinh: |
407 case Builtins::kMathAtan: | 422 case Builtins::kMathAtan: |
408 case Builtins::kMathAtanh: | 423 case Builtins::kMathAtanh: |
409 case Builtins::kMathAtan2: | 424 case Builtins::kMathAtan2: |
410 case Builtins::kMathCeil: | 425 case Builtins::kMathCeil: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 case Builtins::kStringPrototypeToString: | 478 case Builtins::kStringPrototypeToString: |
464 case Builtins::kStringPrototypeToLowerCase: | 479 case Builtins::kStringPrototypeToLowerCase: |
465 case Builtins::kStringPrototypeToUpperCase: | 480 case Builtins::kStringPrototypeToUpperCase: |
466 case Builtins::kStringPrototypeTrim: | 481 case Builtins::kStringPrototypeTrim: |
467 case Builtins::kStringPrototypeTrimLeft: | 482 case Builtins::kStringPrototypeTrimLeft: |
468 case Builtins::kStringPrototypeTrimRight: | 483 case Builtins::kStringPrototypeTrimRight: |
469 case Builtins::kStringPrototypeValueOf: | 484 case Builtins::kStringPrototypeValueOf: |
470 // JSON builtins. | 485 // JSON builtins. |
471 case Builtins::kJsonParse: | 486 case Builtins::kJsonParse: |
472 case Builtins::kJsonStringify: | 487 case Builtins::kJsonStringify: |
| 488 // Error builtins. |
| 489 case Builtins::kMakeError: |
| 490 case Builtins::kMakeTypeError: |
| 491 case Builtins::kMakeSyntaxError: |
| 492 case Builtins::kMakeRangeError: |
| 493 case Builtins::kMakeURIError: |
473 return true; | 494 return true; |
474 default: | 495 default: |
475 if (FLAG_trace_side_effect_free_debug_evaluate) { | 496 if (FLAG_trace_side_effect_free_debug_evaluate) { |
476 PrintF("[debug-evaluate] built-in %s may cause side effect.\n", | 497 PrintF("[debug-evaluate] built-in %s may cause side effect.\n", |
477 Builtins::name(id)); | 498 Builtins::name(id)); |
478 } | 499 } |
479 return false; | 500 return false; |
480 } | 501 } |
481 } | 502 } |
482 | 503 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 560 |
540 if (FLAG_trace_side_effect_free_debug_evaluate) { | 561 if (FLAG_trace_side_effect_free_debug_evaluate) { |
541 PrintF("[debug-evaluate] API Callback at %p may cause side effect.\n", | 562 PrintF("[debug-evaluate] API Callback at %p may cause side effect.\n", |
542 reinterpret_cast<void*>(function_addr)); | 563 reinterpret_cast<void*>(function_addr)); |
543 } | 564 } |
544 return false; | 565 return false; |
545 } | 566 } |
546 | 567 |
547 } // namespace internal | 568 } // namespace internal |
548 } // namespace v8 | 569 } // namespace v8 |
OLD | NEW |