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

Unified Diff: src/runtime.cc

Issue 235083004: Introduce Object::DebugGetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 4f340855e907380dc0fa7ceda43a18219fa13227..094f262df37328b8d60179e57077dfed7d891eab 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -10717,66 +10717,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Break) {
}
-static MaybeObject* DebugLookupResultValue(Heap* heap,
- Object* receiver,
- Name* name,
- LookupResult* result,
- bool* caught_exception) {
- Object* value;
- if (result->IsTransition()) return heap->undefined_value();
- switch (result->type()) {
- case NORMAL:
- value = result->holder()->GetNormalizedProperty(result);
- if (value->IsTheHole()) {
- return heap->undefined_value();
- }
- return value;
- case FIELD: {
- Object* value;
- MaybeObject* maybe_value =
- JSObject::cast(result->holder())->FastPropertyAt(
- result->representation(),
- result->GetFieldIndex().field_index());
- if (!maybe_value->To(&value)) return maybe_value;
- if (value->IsTheHole()) {
- return heap->undefined_value();
- }
- return value;
- }
- case CONSTANT:
- return result->GetConstant();
- case CALLBACKS: {
- Object* structure = result->GetCallbackObject();
- if (structure->IsForeign() || structure->IsAccessorInfo()) {
ulan 2014/04/14 08:39:35 After this change, we no longer check for: structu
- Isolate* isolate = heap->isolate();
- HandleScope scope(isolate);
- MaybeHandle<Object> maybe_value = JSObject::GetPropertyWithCallback(
- handle(result->holder(), isolate),
- handle(receiver, isolate),
- handle(structure, isolate),
- handle(name, isolate));
- Handle<Object> value;
- if (maybe_value.ToHandle(&value)) return *value;
- Object* exception = heap->isolate()->pending_exception();
- heap->isolate()->clear_pending_exception();
- if (caught_exception != NULL) *caught_exception = true;
- return exception;
- } else {
- return heap->undefined_value();
- }
- }
- case INTERCEPTOR:
- return heap->undefined_value();
ulan 2014/04/14 08:39:35 After this change, this can return other values.
- case HANDLER:
- case NONEXISTENT:
- UNREACHABLE();
- return heap->undefined_value();
- }
- UNREACHABLE(); // keep the compiler happy
- return heap->undefined_value();
-}
-
-
// Get debugger related details for an object property.
// args[0]: object holding property
// args[1]: name of the property
@@ -10847,29 +10787,22 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetPropertyDetails) {
result_callback_obj = Handle<Object>(result.GetCallbackObject(),
isolate);
}
- Smi* property_details = result.GetPropertyDetails().AsSmi();
- // DebugLookupResultValue can cause GC so details from LookupResult needs
- // to be copied to handles before this.
- bool caught_exception = false;
- Object* raw_value;
- { MaybeObject* maybe_raw_value =
- DebugLookupResultValue(isolate->heap(), *obj, *name,
- &result, &caught_exception);
- if (!maybe_raw_value->ToObject(&raw_value)) return maybe_raw_value;
- }
- Handle<Object> value(raw_value, isolate);
+
+ bool has_caught;
+ Handle<Object> value = Object::DebugGetProperty(
+ obj, name, &result, &has_caught);
// If the callback object is a fixed array then it contains JavaScript
// getter and/or setter.
- bool hasJavaScriptAccessors = result.IsPropertyCallbacks() &&
- result_callback_obj->IsAccessorPair();
+ bool has_js_accessors = result.IsPropertyCallbacks() &&
+ result_callback_obj->IsAccessorPair();
Handle<FixedArray> details =
- isolate->factory()->NewFixedArray(hasJavaScriptAccessors ? 5 : 2);
+ isolate->factory()->NewFixedArray(has_js_accessors ? 5 : 2);
details->set(0, *value);
- details->set(1, property_details);
- if (hasJavaScriptAccessors) {
+ details->set(1, result.GetPropertyDetails().AsSmi());
+ if (has_js_accessors) {
AccessorPair* accessors = AccessorPair::cast(*result_callback_obj);
- details->set(2, isolate->heap()->ToBoolean(caught_exception));
+ details->set(2, isolate->heap()->ToBoolean(has_caught));
details->set(3, accessors->GetComponent(ACCESSOR_GETTER));
details->set(4, accessors->GetComponent(ACCESSOR_SETTER));
}
@@ -10895,10 +10828,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugGetProperty) {
LookupResult result(isolate);
obj->Lookup(*name, &result);
- if (result.IsFound()) {
- return DebugLookupResultValue(isolate->heap(), *obj, *name, &result, NULL);
- }
- return isolate->heap()->undefined_value();
+ return *Object::DebugGetProperty(obj, name, &result);
}
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698