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

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

Issue 2772853003: [debug] extend debug-evaluate by Map builtins. (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-2.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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } else if (local_function->shared()->scope_info()->HasReceiver() && 252 } else if (local_function->shared()->scope_info()->HasReceiver() &&
253 !frame_->receiver()->IsTheHole(isolate_)) { 253 !frame_->receiver()->IsTheHole(isolate_)) {
254 recv = handle(frame_->receiver(), isolate_); 254 recv = handle(frame_->receiver(), isolate_);
255 } 255 }
256 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); 256 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check();
257 } 257 }
258 258
259 namespace { 259 namespace {
260 260
261 bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) { 261 bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
262 // Use macro to include both inlined and non-inlined version of an intrinsic.
263 #define INTRINSIC_WHITELIST(V) \
jgruber 2017/03/24 08:24:17 Nice.
264 /* Conversions */ \
265 V(ToInteger) \
266 V(ToObject) \
267 V(ToString) \
268 V(ToLength) \
269 V(ToNumber) \
270 /* Type checks */ \
271 V(IsJSReceiver) \
272 V(IsSmi) \
273 V(IsArray) \
274 V(IsFunction) \
275 V(IsDate) \
276 V(IsJSProxy) \
277 V(IsRegExp) \
278 V(IsTypedArray) \
279 V(ClassOf) \
280 /* Loads */ \
281 V(LoadLookupSlotForCall) \
282 /* Arrays */ \
283 V(ArraySpeciesConstructor) \
284 V(NormalizeElements) \
285 V(GetArrayKeys) \
286 V(HasComplexElements) \
287 V(EstimateNumberOfElements) \
288 /* Errors */ \
289 V(ReThrow) \
290 V(ThrowReferenceError) \
291 V(ThrowSymbolIteratorInvalid) \
292 V(ThrowIteratorResultNotAnObject) \
293 V(NewTypeError) \
294 /* Strings */ \
295 V(StringCharCodeAt) \
296 V(StringIndexOf) \
297 V(StringReplaceOneCharWithString) \
298 V(SubString) \
299 V(RegExpInternalReplace) \
300 /* Literals */ \
301 V(CreateArrayLiteral) \
302 V(CreateObjectLiteral) \
303 V(CreateRegExpLiteral) \
304 /* Collections */ \
305 V(JSCollectionGetTable) \
306 V(FixedArrayGet) \
307 V(StringGetRawHashField) \
308 V(GenericHash) \
309 V(MapIteratorInitialize) \
310 V(MapInitialize) \
311 /* Misc. */ \
312 V(ForInPrepare) \
313 V(Call) \
314 V(MaxSmi) \
315 V(HasInPrototypeChain)
316
317 #define CASE(Name) \
318 case Runtime::k##Name: \
319 case Runtime::kInline##Name:
320
262 switch (id) { 321 switch (id) {
263 // Whitelist for intrinsics and runtime functions. 322 INTRINSIC_WHITELIST(CASE)
264 // Conversions. 323 return true;
265 case Runtime::kToInteger:
266 case Runtime::kInlineToInteger:
267 case Runtime::kToObject:
268 case Runtime::kInlineToObject:
269 case Runtime::kToString:
270 case Runtime::kInlineToString:
271 case Runtime::kToLength:
272 case Runtime::kInlineToLength:
273 case Runtime::kToNumber:
274 // Type checks.
275 case Runtime::kIsJSReceiver:
276 case Runtime::kInlineIsJSReceiver:
277 case Runtime::kIsSmi:
278 case Runtime::kInlineIsSmi:
279 case Runtime::kIsArray:
280 case Runtime::kInlineIsArray:
281 case Runtime::kIsFunction:
282 case Runtime::kIsDate:
283 case Runtime::kIsJSProxy:
284 case Runtime::kIsRegExp:
285 case Runtime::kIsTypedArray:
286 // Loads.
287 case Runtime::kLoadLookupSlotForCall:
288 // Arrays.
289 case Runtime::kArraySpeciesConstructor:
290 case Runtime::kNormalizeElements:
291 case Runtime::kGetArrayKeys:
292 case Runtime::kHasComplexElements:
293 case Runtime::kEstimateNumberOfElements:
294 // Errors.
295 case Runtime::kReThrow:
296 case Runtime::kThrowReferenceError:
297 case Runtime::kThrowSymbolIteratorInvalid:
298 case Runtime::kThrowIteratorResultNotAnObject:
299 case Runtime::kNewTypeError:
300 // Strings.
301 case Runtime::kInlineStringCharCodeAt:
302 case Runtime::kStringCharCodeAt:
303 case Runtime::kStringIndexOf:
304 case Runtime::kStringReplaceOneCharWithString:
305 case Runtime::kSubString:
306 case Runtime::kInlineSubString:
307 case Runtime::kRegExpInternalReplace:
308 // Literals.
309 case Runtime::kCreateArrayLiteral:
310 case Runtime::kCreateObjectLiteral:
311 case Runtime::kCreateRegExpLiteral:
312 // Misc.
313 case Runtime::kForInPrepare:
314 case Runtime::kInlineCall:
315 case Runtime::kCall:
316 case Runtime::kInlineMaxSmi:
317 case Runtime::kMaxSmi:
318 case Runtime::kHasInPrototypeChain:
319 return true;
320 default: 324 default:
321 if (FLAG_trace_side_effect_free_debug_evaluate) { 325 if (FLAG_trace_side_effect_free_debug_evaluate) {
322 PrintF("[debug-evaluate] intrinsic %s may cause side effect.\n", 326 PrintF("[debug-evaluate] intrinsic %s may cause side effect.\n",
323 Runtime::FunctionForId(id)->name); 327 Runtime::FunctionForId(id)->name);
324 } 328 }
325 return false; 329 return false;
326 } 330 }
331
332 #undef CASE
333 #undef INTRINSIC_WHITELIST
327 } 334 }
328 335
329 bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) { 336 bool BytecodeHasNoSideEffect(interpreter::Bytecode bytecode) {
330 typedef interpreter::Bytecode Bytecode; 337 typedef interpreter::Bytecode Bytecode;
331 typedef interpreter::Bytecodes Bytecodes; 338 typedef interpreter::Bytecodes Bytecodes;
332 if (Bytecodes::IsWithoutExternalSideEffects(bytecode)) return true; 339 if (Bytecodes::IsWithoutExternalSideEffects(bytecode)) return true;
333 if (Bytecodes::IsCallOrConstruct(bytecode)) return true; 340 if (Bytecodes::IsCallOrConstruct(bytecode)) return true;
334 if (Bytecodes::WritesBooleanToAccumulator(bytecode)) return true; 341 if (Bytecodes::WritesBooleanToAccumulator(bytecode)) return true;
335 if (Bytecodes::IsJumpIfToBoolean(bytecode)) return true; 342 if (Bytecodes::IsJumpIfToBoolean(bytecode)) return true;
336 if (Bytecodes::IsPrefixScalingBytecode(bytecode)) return true; 343 if (Bytecodes::IsPrefixScalingBytecode(bytecode)) return true;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // JSON builtins. 556 // JSON builtins.
550 case Builtins::kJsonParse: 557 case Builtins::kJsonParse:
551 case Builtins::kJsonStringify: 558 case Builtins::kJsonStringify:
552 // Global function builtins. 559 // Global function builtins.
553 case Builtins::kGlobalDecodeURI: 560 case Builtins::kGlobalDecodeURI:
554 case Builtins::kGlobalDecodeURIComponent: 561 case Builtins::kGlobalDecodeURIComponent:
555 case Builtins::kGlobalEncodeURI: 562 case Builtins::kGlobalEncodeURI:
556 case Builtins::kGlobalEncodeURIComponent: 563 case Builtins::kGlobalEncodeURIComponent:
557 case Builtins::kGlobalEscape: 564 case Builtins::kGlobalEscape:
558 case Builtins::kGlobalUnescape: 565 case Builtins::kGlobalUnescape:
566 case Builtins::kGlobalIsFinite:
567 case Builtins::kGlobalIsNaN:
559 // Error builtins. 568 // Error builtins.
560 case Builtins::kMakeError: 569 case Builtins::kMakeError:
561 case Builtins::kMakeTypeError: 570 case Builtins::kMakeTypeError:
562 case Builtins::kMakeSyntaxError: 571 case Builtins::kMakeSyntaxError:
563 case Builtins::kMakeRangeError: 572 case Builtins::kMakeRangeError:
564 case Builtins::kMakeURIError: 573 case Builtins::kMakeURIError:
565 return true; 574 return true;
566 default: 575 default:
567 if (FLAG_trace_side_effect_free_debug_evaluate) { 576 if (FLAG_trace_side_effect_free_debug_evaluate) {
568 PrintF("[debug-evaluate] built-in %s may cause side effect.\n", 577 PrintF("[debug-evaluate] built-in %s may cause side effect.\n",
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 645
637 if (FLAG_trace_side_effect_free_debug_evaluate) { 646 if (FLAG_trace_side_effect_free_debug_evaluate) {
638 PrintF("[debug-evaluate] API Callback at %p may cause side effect.\n", 647 PrintF("[debug-evaluate] API Callback at %p may cause side effect.\n",
639 reinterpret_cast<void*>(function_addr)); 648 reinterpret_cast<void*>(function_addr));
640 } 649 }
641 return false; 650 return false;
642 } 651 }
643 652
644 } // namespace internal 653 } // namespace internal
645 } // namespace v8 654 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/debugger/debug/debug-evaluate-no-side-effect-builtins-2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698