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

Side by Side Diff: src/runtime.cc

Issue 18194: Changes to the V8 debugger support which otherwise caused problems with Chrom... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/mirror-delay.js ('k') | test/cctest/test-debug.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 4518 matching lines...) Expand 10 before | Expand all | Expand 10 after
4529 } 4529 }
4530 4530
4531 4531
4532 static Object* Runtime_Break(Arguments args) { 4532 static Object* Runtime_Break(Arguments args) {
4533 ASSERT(args.length() == 0); 4533 ASSERT(args.length() == 0);
4534 StackGuard::DebugBreak(); 4534 StackGuard::DebugBreak();
4535 return Heap::undefined_value(); 4535 return Heap::undefined_value();
4536 } 4536 }
4537 4537
4538 4538
4539 static Object* DebugLookupResultValue(Object* obj, String* name, 4539 static Object* DebugLookupResultValue(Object* receiver, LookupResult* result,
4540 LookupResult* result,
4541 bool* caught_exception) { 4540 bool* caught_exception) {
4541 Object* value;
4542 switch (result->type()) { 4542 switch (result->type()) {
4543 case NORMAL: 4543 case NORMAL: {
4544 case FIELD: 4544 Dictionary* dict =
4545 case CONSTANT_FUNCTION: 4545 JSObject::cast(result->holder())->property_dictionary();
4546 return obj->GetProperty(name); 4546 value = dict->ValueAt(result->GetDictionaryEntry());
4547 case CALLBACKS: { 4547 if (value->IsTheHole()) {
4548 // Get the property value. If there is an exception it must be thrown from 4548 return Heap::undefined_value();
4549 // a JavaScript getter.
4550 Object* value;
4551 value = obj->GetProperty(name);
4552 if (value->IsException()) {
4553 if (caught_exception != NULL) {
4554 *caught_exception = true;
4555 }
4556 value = Top::pending_exception();
4557 Top::optional_reschedule_exception(true);
4558 } 4549 }
4559 ASSERT(!Top::has_pending_exception());
4560 ASSERT(!Top::external_caught_exception());
4561 return value; 4550 return value;
4562 } 4551 }
4552 case FIELD:
4553 value =
4554 JSObject::cast(
4555 result->holder())->FastPropertyAt(result->GetFieldIndex());
4556 if (value->IsTheHole()) {
4557 return Heap::undefined_value();
4558 }
4559 return value;
4560 case CONSTANT_FUNCTION:
4561 return result->GetConstantFunction();
4562 case CALLBACKS: {
4563 Object* structure = result->GetCallbackObject();
4564 if (structure->IsProxy()) {
4565 AccessorDescriptor* callback =
4566 reinterpret_cast<AccessorDescriptor*>(
4567 Proxy::cast(structure)->proxy());
4568 value = (callback->getter)(receiver, callback->data);
4569 if (value->IsFailure()) {
4570 value = Top::pending_exception();
4571 Top::clear_pending_exception();
4572 if (caught_exception != NULL) {
4573 *caught_exception = true;
4574 }
4575 }
4576 return value;
4577 } else {
4578 return Heap::undefined_value();
4579 }
4580 }
4563 case INTERCEPTOR: 4581 case INTERCEPTOR:
4564 return obj->GetProperty(name);
4565 case MAP_TRANSITION: 4582 case MAP_TRANSITION:
4566 case CONSTANT_TRANSITION: 4583 case CONSTANT_TRANSITION:
4567 case NULL_DESCRIPTOR: 4584 case NULL_DESCRIPTOR:
4568 return Heap::undefined_value(); 4585 return Heap::undefined_value();
4569 default: 4586 default:
4570 UNREACHABLE(); 4587 UNREACHABLE();
4571 } 4588 }
4572 UNREACHABLE(); 4589 UNREACHABLE();
4573 return Heap::undefined_value(); 4590 return Heap::undefined_value();
4574 } 4591 }
(...skipping 27 matching lines...) Expand all
4602 details->set(0, Runtime::GetElementOrCharAt(obj, index)); 4619 details->set(0, Runtime::GetElementOrCharAt(obj, index));
4603 details->set(1, PropertyDetails(NONE, NORMAL).AsSmi()); 4620 details->set(1, PropertyDetails(NONE, NORMAL).AsSmi());
4604 return *Factory::NewJSArrayWithElements(details); 4621 return *Factory::NewJSArrayWithElements(details);
4605 } 4622 }
4606 4623
4607 // Perform standard local lookup on the object. 4624 // Perform standard local lookup on the object.
4608 LookupResult result; 4625 LookupResult result;
4609 obj->LocalLookup(*name, &result); 4626 obj->LocalLookup(*name, &result);
4610 if (result.IsProperty()) { 4627 if (result.IsProperty()) {
4611 bool caught_exception = false; 4628 bool caught_exception = false;
4612 Handle<Object> value(DebugLookupResultValue(*obj, *name, &result, 4629 Handle<Object> value(DebugLookupResultValue(*obj, &result,
4613 &caught_exception)); 4630 &caught_exception));
4614 // If the callback object is a fixed array then it contains JavaScript 4631 // If the callback object is a fixed array then it contains JavaScript
4615 // getter and/or setter. 4632 // getter and/or setter.
4616 bool hasJavaScriptAccessors = result.type() == CALLBACKS && 4633 bool hasJavaScriptAccessors = result.type() == CALLBACKS &&
4617 result.GetCallbackObject()->IsFixedArray(); 4634 result.GetCallbackObject()->IsFixedArray();
4618 Handle<FixedArray> details = 4635 Handle<FixedArray> details =
4619 Factory::NewFixedArray(hasJavaScriptAccessors ? 5 : 2); 4636 Factory::NewFixedArray(hasJavaScriptAccessors ? 5 : 2);
4620 details->set(0, *value); 4637 details->set(0, *value);
4621 details->set(1, result.GetPropertyDetails().AsSmi()); 4638 details->set(1, result.GetPropertyDetails().AsSmi());
4622 if (hasJavaScriptAccessors) { 4639 if (hasJavaScriptAccessors) {
(...skipping 13 matching lines...) Expand all
4636 HandleScope scope; 4653 HandleScope scope;
4637 4654
4638 ASSERT(args.length() == 2); 4655 ASSERT(args.length() == 2);
4639 4656
4640 CONVERT_ARG_CHECKED(JSObject, obj, 0); 4657 CONVERT_ARG_CHECKED(JSObject, obj, 0);
4641 CONVERT_ARG_CHECKED(String, name, 1); 4658 CONVERT_ARG_CHECKED(String, name, 1);
4642 4659
4643 LookupResult result; 4660 LookupResult result;
4644 obj->Lookup(*name, &result); 4661 obj->Lookup(*name, &result);
4645 if (result.IsProperty()) { 4662 if (result.IsProperty()) {
4646 return DebugLookupResultValue(*obj, *name, &result, NULL); 4663 return DebugLookupResultValue(*obj, &result, NULL);
4647 } 4664 }
4648 return Heap::undefined_value(); 4665 return Heap::undefined_value();
4649 } 4666 }
4650 4667
4651 4668
4652 // Return the names of the local named properties. 4669 // Return the names of the local named properties.
4653 // args[0]: object 4670 // args[0]: object
4654 static Object* Runtime_DebugLocalPropertyNames(Arguments args) { 4671 static Object* Runtime_DebugLocalPropertyNames(Arguments args) {
4655 HandleScope scope; 4672 HandleScope scope;
4656 ASSERT(args.length() == 1); 4673 ASSERT(args.length() == 1);
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
5961 } else { 5978 } else {
5962 // Handle last resort GC and make sure to allow future allocations 5979 // Handle last resort GC and make sure to allow future allocations
5963 // to grow the heap without causing GCs (if possible). 5980 // to grow the heap without causing GCs (if possible).
5964 Counters::gc_last_resort_from_js.Increment(); 5981 Counters::gc_last_resort_from_js.Increment();
5965 Heap::CollectAllGarbage(); 5982 Heap::CollectAllGarbage();
5966 } 5983 }
5967 } 5984 }
5968 5985
5969 5986
5970 } } // namespace v8::internal 5987 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mirror-delay.js ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698