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

Unified Diff: src/runtime.cc

Issue 27000006: Handlify GetNormalizedProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 77014b1771c054e1ec8da1c400b2c2533dc421b0..276d3882d697c3264c277efc6ece15250a0d0080 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -2267,7 +2267,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
// All constants are declared with an initial value. The name
// of the constant is the first argument and the initial value
// is the second.
@@ -2276,7 +2276,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
Handle<Object> value = args.at<Object>(1);
// Get the current global object from top.
- GlobalObject* global = isolate->context()->global_object();
+ Handle<JSObject> global(isolate->context()->global_object(), isolate);
// According to ECMA-262, section 12.2, page 62, the property must
// not be deletable. Since it's a const, it must be READ_ONLY too.
@@ -2291,8 +2291,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
LookupResult lookup(isolate);
global->LocalLookup(*name, &lookup);
if (!lookup.IsFound()) {
- HandleScope handle_scope(isolate);
- Handle<GlobalObject> global(isolate->context()->global_object());
RETURN_IF_EMPTY_HANDLE(
isolate,
JSObject::SetLocalPropertyIgnoreAttributes(global, name, value,
@@ -2303,8 +2301,6 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
if (!lookup.IsReadOnly()) {
// Restore global object from context (in case of GC) and continue
// with setting the value.
- HandleScope handle_scope(isolate);
- Handle<GlobalObject> global(isolate->context()->global_object());
// BUG 1213575: Handle the case where we have to set a read-only
// property through an interceptor and only do it if it's
@@ -2322,16 +2318,15 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
// current value is the hole.
// Strict mode handling not needed (const is disallowed in strict mode).
if (lookup.IsField()) {
- FixedArray* properties = global->properties();
+ Handle<FixedArray> properties(global->properties(), isolate);
int index = lookup.GetFieldIndex().field_index();
if (properties->get(index)->IsTheHole() || !lookup.IsReadOnly()) {
properties->set(index, *value);
}
} else if (lookup.IsNormal()) {
- if (global->GetNormalizedProperty(&lookup)->IsTheHole() ||
+ if (JSObject::GetNormalizedProperty(global, &lookup)->IsTheHole() ||
!lookup.IsReadOnly()) {
- HandleScope scope(isolate);
- JSObject::SetNormalizedProperty(Handle<JSObject>(global), &lookup, value);
+ JSObject::SetNormalizedProperty(global, &lookup, value);
}
} else {
// Ignore re-initialization of constants that have already been
@@ -2419,7 +2414,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
properties->set(index, *value);
}
} else if (lookup.IsNormal()) {
- if (object->GetNormalizedProperty(&lookup)->IsTheHole()) {
+ if (JSObject::GetNormalizedProperty(object, &lookup)->IsTheHole()) {
JSObject::SetNormalizedProperty(object, &lookup, value);
}
} else {
@@ -5090,7 +5085,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
// Return property without being observable by accessors or interceptors.
RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDataProperty) {
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
ASSERT(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
@@ -5098,8 +5093,12 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDataProperty) {
object->LookupRealNamedProperty(*key, &lookup);
if (!lookup.IsFound()) return isolate->heap()->undefined_value();
switch (lookup.type()) {
- case NORMAL:
- return lookup.holder()->GetNormalizedProperty(&lookup);
+ case NORMAL: {
+ Handle<Object> value =
+ JSObject::GetNormalizedProperty(handle(lookup.holder()), &lookup);
+ if (value->IsTheHole()) break;
+ return *value;
+ }
case FIELD:
return lookup.holder()->FastPropertyAt(
lookup.representation(),
@@ -10673,12 +10672,12 @@ static MaybeObject* DebugLookupResultValue(Heap* heap,
bool* caught_exception) {
Object* value;
switch (result->type()) {
- case NORMAL:
- value = result->holder()->GetNormalizedProperty(result);
- if (value->IsTheHole()) {
- return heap->undefined_value();
- }
- return value;
+ case NORMAL: {
+ HandleScope scope(name->GetIsolate());
+ Handle<Object> value =
+ JSObject::GetNormalizedProperty(handle(result->holder()), result);
+ return (value->IsTheHole()) ? heap->undefined_value() : *value;
+ }
case FIELD: {
Object* value;
MaybeObject* maybe_value =

Powered by Google App Engine
This is Rietveld 408576698