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

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

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/property-descriptor.cc ('k') | src/runtime/runtime-i18n.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/debug/debug-evaluate.h" 9 #include "src/debug/debug-evaluate.h"
10 #include "src/debug/debug-frames.h" 10 #include "src/debug/debug-frames.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 296
297 // Check if the name is trivially convertible to an index and get the element 297 // Check if the name is trivially convertible to an index and get the element
298 // if so. 298 // if so.
299 uint32_t index; 299 uint32_t index;
300 // TODO(verwaest): Make sure DebugGetProperty can handle arrays, and remove 300 // TODO(verwaest): Make sure DebugGetProperty can handle arrays, and remove
301 // this special case. 301 // this special case.
302 if (name->AsArrayIndex(&index)) { 302 if (name->AsArrayIndex(&index)) {
303 Handle<FixedArray> details = isolate->factory()->NewFixedArray(2); 303 Handle<FixedArray> details = isolate->factory()->NewFixedArray(2);
304 Handle<Object> element_or_char; 304 Handle<Object> element_or_char;
305 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element_or_char, 305 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
306 Object::GetElement(isolate, obj, index)); 306 isolate, element_or_char, JSReceiver::GetElement(isolate, obj, index));
307 details->set(0, *element_or_char); 307 details->set(0, *element_or_char);
308 details->set(1, PropertyDetails::Empty().AsSmi()); 308 details->set(1, PropertyDetails::Empty().AsSmi());
309 return *isolate->factory()->NewJSArrayWithElements(details); 309 return *isolate->factory()->NewJSArrayWithElements(details);
310 } 310 }
311 311
312 LookupIterator it(obj, name, LookupIterator::HIDDEN); 312 LookupIterator it(obj, name, LookupIterator::HIDDEN);
313 bool has_caught = false; 313 bool has_caught = false;
314 Handle<Object> value = DebugGetProperty(&it, &has_caught); 314 Handle<Object> value = DebugGetProperty(&it, &has_caught);
315 if (!it.IsFound()) return isolate->heap()->undefined_value(); 315 if (!it.IsFound()) return isolate->heap()->undefined_value();
316 316
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // Return element value from indexed interceptor. 411 // Return element value from indexed interceptor.
412 // args[0]: object 412 // args[0]: object
413 // args[1]: index 413 // args[1]: index
414 RUNTIME_FUNCTION(Runtime_DebugIndexedInterceptorElementValue) { 414 RUNTIME_FUNCTION(Runtime_DebugIndexedInterceptorElementValue) {
415 HandleScope scope(isolate); 415 HandleScope scope(isolate);
416 DCHECK(args.length() == 2); 416 DCHECK(args.length() == 2);
417 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); 417 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
418 RUNTIME_ASSERT(obj->HasIndexedInterceptor()); 418 RUNTIME_ASSERT(obj->HasIndexedInterceptor());
419 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]); 419 CONVERT_NUMBER_CHECKED(uint32_t, index, Uint32, args[1]);
420 Handle<Object> result; 420 Handle<Object> result;
421 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 421 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
422 Object::GetElement(isolate, obj, index)); 422 isolate, result, JSReceiver::GetElement(isolate, obj, index));
423 return *result; 423 return *result;
424 } 424 }
425 425
426 426
427 RUNTIME_FUNCTION(Runtime_CheckExecutionState) { 427 RUNTIME_FUNCTION(Runtime_CheckExecutionState) {
428 SealHandleScope shs(isolate); 428 SealHandleScope shs(isolate);
429 DCHECK(args.length() == 1); 429 DCHECK(args.length() == 1);
430 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 430 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
431 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); 431 RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id));
432 return isolate->heap()->true_value(); 432 return isolate->heap()->true_value();
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 return Smi::FromInt(isolate->debug()->is_active()); 1675 return Smi::FromInt(isolate->debug()->is_active());
1676 } 1676 }
1677 1677
1678 1678
1679 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1679 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1680 UNIMPLEMENTED(); 1680 UNIMPLEMENTED();
1681 return NULL; 1681 return NULL;
1682 } 1682 }
1683 } // namespace internal 1683 } // namespace internal
1684 } // namespace v8 1684 } // namespace v8
OLDNEW
« no previous file with comments | « src/property-descriptor.cc ('k') | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698