Revision: 20611
Author:   [email protected]
Date:     Wed Apr  9 12:21:47 2014 UTC
Log:      Remove calls to non-handlified version of GetProperty(name).

[email protected]

Review URL: https://codereview.chromium.org/229973004
http://code.google.com/p/v8/source/detail?r=20611

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/bootstrapper.cc
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/factory.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/messages.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/test/cctest/test-compiler.cc
 /branches/bleeding_edge/test/cctest/test-heap.cc
 /branches/bleeding_edge/test/cctest/test-mark-compact.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Tue Apr  8 09:49:49 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Wed Apr  9 12:21:47 2014 UTC
@@ -2036,10 +2036,10 @@
   i::Isolate* isolate = i::Isolate::Current();
   i::Handle<i::String> fmt_str =
       isolate->factory()->InternalizeUtf8String(name);
-  i::Object* object_fun =
- isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str);
-  i::Handle<i::JSFunction> fun =
-      i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun));
+  i::Handle<i::Object> object_fun =
+      i::GlobalObject::GetPropertyNoExceptionThrown(
+          isolate->js_builtins_object(), fmt_str);
+ i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction>::cast(object_fun);
   i::Handle<i::Object> value = i::Execution::Call(
       isolate, fun, recv, argc, argv, has_pending_exception);
   return value;
@@ -2484,8 +2484,8 @@
                                 const char* builtin_name) {
   i::Handle<i::String> string =
       isolate->factory()->InternalizeUtf8String(builtin_name);
-  i::Handle<i::JSBuiltinsObject> builtins = isolate->js_builtins_object();
-  return builtins->GetPropertyNoExceptionThrown(*string);
+  return *i::GlobalObject::GetPropertyNoExceptionThrown(
+      isolate->js_builtins_object(), string);
 }


=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Fri Apr  4 12:06:11 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Wed Apr  9 12:21:47 2014 UTC
@@ -1515,13 +1515,12 @@
 }


-#define INSTALL_NATIVE(Type, name, var)                                 \
-  Handle<String> var##_name =                                           \
-    factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name));     \
-  Object* var##_native =                                                \
-      native_context()->builtins()->GetPropertyNoExceptionThrown(       \
-           *var##_name);                                                \
-  native_context()->set_##var(Type::cast(var##_native));
+#define INSTALL_NATIVE(Type, name, var) \ + Handle<String> var##_name = \ + factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR(name)); \ + Handle<Object> var##_native = GlobalObject::GetPropertyNoExceptionThrown( \ + handle(native_context()->builtins()), var##_name); \
+  native_context()->set_##var(Type::cast(*var##_native));


 void Genesis::InstallNativeFunctions() {
@@ -2054,8 +2053,9 @@
                                      BuiltinFunctionId id) {
   Factory* factory = holder->GetIsolate()->factory();
   Handle<String> name = factory->InternalizeUtf8String(function_name);
- Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
-  Handle<JSFunction> function(JSFunction::cast(function_object));
+  Handle<Object> function_object = Object::GetProperty(holder, name);
+  ASSERT(!function_object.is_null());
+  Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
   function->shared()->set_function_data(Smi::FromInt(id));
 }

@@ -2349,9 +2349,9 @@
     Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
     Handle<String> name =
         factory()->InternalizeUtf8String(Builtins::GetName(id));
- Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
-    Handle<JSFunction> function
-        = Handle<JSFunction>(JSFunction::cast(function_object));
+    Handle<Object> function_object =
+        GlobalObject::GetPropertyNoExceptionThrown(builtins, name);
+ Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
     builtins->set_javascript_builtin(id, *function);
     if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) {
       return false;
=======================================
--- /branches/bleeding_edge/src/debug.cc        Fri Apr  4 16:18:59 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Wed Apr  9 12:21:47 2014 UTC
@@ -1116,10 +1116,10 @@
   Handle<String> is_break_point_triggered_string =
       factory->InternalizeOneByteString(
           STATIC_ASCII_VECTOR("IsBreakPointTriggered"));
+  Handle<GlobalObject> debug_global(debug_context()->global_object());
   Handle<JSFunction> check_break_point =
-    Handle<JSFunction>(JSFunction::cast(
-        debug_context()->global_object()->GetPropertyNoExceptionThrown(
-            *is_break_point_triggered_string)));
+    Handle<JSFunction>::cast(GlobalObject::GetPropertyNoExceptionThrown(
+        debug_global, is_break_point_triggered_string));

   // Get the break id as an object.
   Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id());
@@ -2463,9 +2463,8 @@
   // Clear the mirror cache.
Handle<String> function_name = isolate_->factory()->InternalizeOneByteString(
       STATIC_ASCII_VECTOR("ClearMirrorCache"));
-  Handle<Object> fun(
- isolate_->global_object()->GetPropertyNoExceptionThrown(*function_name),
-      isolate_);
+  Handle<Object> fun = GlobalObject::GetPropertyNoExceptionThrown(
+      isolate_->global_object(), function_name);
   ASSERT(fun->IsJSFunction());
   bool caught_exception;
   Execution::TryCall(Handle<JSFunction>::cast(fun),
@@ -2601,9 +2600,8 @@
   Handle<String> constructor_str =
       isolate_->factory()->InternalizeUtf8String(constructor_name);
   ASSERT(!constructor_str.is_null());
-  Handle<Object> constructor(
- isolate_->global_object()->GetPropertyNoExceptionThrown(*constructor_str),
-      isolate_);
+  Handle<Object> constructor = GlobalObject::GetPropertyNoExceptionThrown(
+      isolate_->global_object(), constructor_str);
   ASSERT(constructor->IsJSFunction());
   if (!constructor->IsJSFunction()) {
     *caught_exception = true;
@@ -2833,11 +2831,10 @@
   Handle<String> update_script_break_points_string =
       isolate_->factory()->InternalizeOneByteString(
           STATIC_ASCII_VECTOR("UpdateScriptBreakPoints"));
+ Handle<GlobalObject> debug_global(debug->debug_context()->global_object());
   Handle<Object> update_script_break_points =
-      Handle<Object>(
- debug->debug_context()->global_object()->GetPropertyNoExceptionThrown(
-              *update_script_break_points_string),
-          isolate_);
+      GlobalObject::GetPropertyNoExceptionThrown(
+          debug_global, update_script_break_points_string);
   if (!update_script_break_points->IsJSFunction()) {
     return;
   }
=======================================
--- /branches/bleeding_edge/src/factory.cc      Wed Apr  9 08:51:46 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc      Wed Apr  9 12:21:47 2014 UTC
@@ -1128,9 +1128,8 @@
                                  const char* message,
                                  Handle<JSArray> args) {
   Handle<String> make_str = InternalizeUtf8String(maker);
-  Handle<Object> fun_obj(
- isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str),
-      isolate());
+  Handle<Object> fun_obj = GlobalObject::GetPropertyNoExceptionThrown(
+      isolate()->js_builtins_object(), make_str);
   // If the builtins haven't been properly configured yet this error
   // constructor may not have been defined.  Bail out.
   if (!fun_obj->IsJSFunction()) {
@@ -1160,9 +1159,9 @@
 Handle<Object> Factory::NewError(const char* constructor,
                                  Handle<String> message) {
   Handle<String> constr = InternalizeUtf8String(constructor);
-  Handle<JSFunction> fun = Handle<JSFunction>(
-      JSFunction::cast(isolate()->js_builtins_object()->
-                       GetPropertyNoExceptionThrown(*constr)));
+  Handle<JSFunction> fun = Handle<JSFunction>::cast(
+      GlobalObject::GetPropertyNoExceptionThrown(
+          isolate()->js_builtins_object(), constr));
   Handle<Object> argv[] = { message };

   // Invoke the JavaScript factory method. If an exception is thrown while
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Tue Apr  8 09:44:24 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Wed Apr  9 12:21:47 2014 UTC
@@ -1046,15 +1046,17 @@
 bool Isolate::IsErrorObject(Handle<Object> obj) {
   if (!obj->IsJSObject()) return false;

-  String* error_key =
- *(factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error")));
-  Object* error_constructor =
-      js_builtins_object()->GetPropertyNoExceptionThrown(error_key);
+  Handle<String> error_key =
+      factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error"));
+ Handle<Object> error_constructor = GlobalObject::GetPropertyNoExceptionThrown(
+      js_builtins_object(), error_key);

+  DisallowHeapAllocation no_gc;
   for (Object* prototype = *obj; !prototype->IsNull();
        prototype = prototype->GetPrototype(this)) {
     if (!prototype->IsJSObject()) return false;
- if (JSObject::cast(prototype)->map()->constructor() == error_constructor) {
+    if (JSObject::cast(prototype)->map()->constructor() ==
+        *error_constructor) {
       return true;
     }
   }
=======================================
--- /branches/bleeding_edge/src/messages.cc     Tue Apr  8 09:49:49 2014 UTC
+++ /branches/bleeding_edge/src/messages.cc     Wed Apr  9 12:21:47 2014 UTC
@@ -154,11 +154,9 @@
   Factory* factory = isolate->factory();
   Handle<String> fmt_str =
factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("FormatMessage"));
-  Handle<JSFunction> fun =
-      Handle<JSFunction>(
-          JSFunction::cast(
-              isolate->js_builtins_object()->
-              GetPropertyNoExceptionThrown(*fmt_str)));
+  Handle<JSFunction> fun = Handle<JSFunction>::cast(
+      GlobalObject::GetPropertyNoExceptionThrown(
+          isolate->js_builtins_object(), fmt_str));
   Handle<JSMessageObject> message = Handle<JSMessageObject>::cast(data);
   Handle<Object> argv[] = { Handle<Object>(message->type(), isolate),
Handle<Object>(message->arguments(), isolate) };
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Apr  9 09:50:25 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Wed Apr  9 12:21:47 2014 UTC
@@ -3068,6 +3068,15 @@
   WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0);
 #endif
 }
+
+
+Handle<Object> GlobalObject::GetPropertyNoExceptionThrown(
+    Handle<GlobalObject> global,
+    Handle<Name> name) {
+  Handle<Object> result = Object::GetProperty(global, name);
+  CHECK_NOT_EMPTY_HANDLE(name->GetIsolate(), result);
+  return result;
+}


 bool Name::Equals(Name* other) {
=======================================
--- /branches/bleeding_edge/src/objects.h       Wed Apr  9 11:01:58 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Wed Apr  9 12:21:47 2014 UTC
@@ -7776,10 +7776,9 @@
   // by throwing an exception.  This is for the debug and builtins global
// objects, where it is known which properties can be expected to be present
   // on the object.
-  Object* GetPropertyNoExceptionThrown(Name* key) {
-    Object* answer = GetProperty(key)->ToObjectUnchecked();
-    return answer;
-  }
+  static inline Handle<Object> GetPropertyNoExceptionThrown(
+      Handle<GlobalObject> global,
+      Handle<Name> name);

   // Casting.
   static inline GlobalObject* cast(Object* obj);
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Wed Apr  9 08:51:46 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Wed Apr  9 12:21:47 2014 UTC
@@ -6045,14 +6045,16 @@
     return frame->GetParameter(index);
   }

+  HandleScope scope(isolate);
   if (args[0]->IsSymbol()) {
     // Lookup in the initial Object.prototype object.
-    return isolate->initial_object_prototype()->GetProperty(
-        Symbol::cast(args[0]));
+    Handle<Object> result = Object::GetProperty(
+        isolate->initial_object_prototype(), args.at<Symbol>(0));
+    RETURN_IF_EMPTY_HANDLE(isolate, result);
+    return *result;
   }

   // Convert the key to a string.
-  HandleScope scope(isolate);
   bool exception = false;
   Handle<Object> converted =
       Execution::ToString(isolate, args.at<Object>(0), &exception);
@@ -6084,7 +6086,10 @@
   }

   // Lookup in the initial Object.prototype object.
-  return isolate->initial_object_prototype()->GetProperty(*key);
+  Handle<Object> result = Object::GetProperty(
+      isolate->initial_object_prototype(), key);
+  RETURN_IF_EMPTY_HANDLE(isolate, result);
+  return *result;
 }


@@ -9327,8 +9332,10 @@

     // No need to unhole the value here.  This is taken care of by the
     // GetProperty function.
-    MaybeObject* value = object->GetProperty(*name);
-    return MakePair(value, *receiver_handle);
+    Handle<Object> value = Object::GetProperty(object, name);
+    RETURN_IF_EMPTY_HANDLE_VALUE(
+        isolate, value, MakePair(Failure::Exception(), NULL));
+    return MakePair(*value, *receiver_handle);
   }

   if (throw_error) {
=======================================
--- /branches/bleeding_edge/test/cctest/test-compiler.cc Tue Apr 8 09:44:24 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-compiler.cc Wed Apr 9 12:21:47 2014 UTC
@@ -36,11 +36,12 @@

 using namespace v8::internal;

-static MaybeObject* GetGlobalProperty(const char* name) {
+static Handle<Object> GetGlobalProperty(const char* name) {
   Isolate* isolate = CcTest::i_isolate();
   Handle<String> internalized_name =
       isolate->factory()->InternalizeUtf8String(name);
- return isolate->context()->global_object()->GetProperty(*internalized_name);
+  return GlobalObject::GetPropertyNoExceptionThrown(
+      isolate->global_object(), internalized_name);
 }


@@ -85,7 +86,7 @@
   Handle<JSObject> global(isolate->context()->global_object());
   Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
   CHECK(!has_pending_exception);
-  return GetGlobalProperty("result")->ToObjectChecked()->Number();
+  return GetGlobalProperty("result")->Number();
 }


@@ -106,7 +107,7 @@
   Handle<JSObject> global(isolate->context()->global_object());
   Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
   CHECK(!has_pending_exception);
-  return GetGlobalProperty("result")->ToObjectChecked()->Number();
+  return GetGlobalProperty("result")->Number();
 }


@@ -126,7 +127,7 @@
   Handle<JSObject> global(isolate->context()->global_object());
   Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
   CHECK(!has_pending_exception);
-  return GetGlobalProperty("result")->ToObjectChecked()->Number();
+  return GetGlobalProperty("result")->Number();
 }


@@ -147,7 +148,7 @@
   Handle<JSObject> global(isolate->context()->global_object());
   Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
   CHECK(!has_pending_exception);
-  return GetGlobalProperty("result")->ToObjectChecked()->Number();
+  return GetGlobalProperty("result")->Number();
 }


@@ -204,7 +205,7 @@
   Execution::Call(
       CcTest::i_isolate(), fun, global, 0, NULL, &has_pending_exception);
   CHECK(!has_pending_exception);
-  CHECK_EQ(511.0, GetGlobalProperty("r")->ToObjectChecked()->Number());
+  CHECK_EQ(511.0, GetGlobalProperty("r")->Number());
 }


@@ -250,11 +251,10 @@
       isolate, fun0, global, 0, NULL, &has_pending_exception);
   CHECK(!has_pending_exception);

-  Object* foo_string = isolate->factory()->InternalizeOneByteString(
-      STATIC_ASCII_VECTOR("foo"))->ToObjectChecked();
-  MaybeObject* fun1_object = isolate->context()->global_object()->
-      GetProperty(String::cast(foo_string));
-  Handle<Object> fun1(fun1_object->ToObjectChecked(), isolate);
+  Handle<String> foo_string = isolate->factory()->InternalizeOneByteString(
+      STATIC_ASCII_VECTOR("foo"));
+  Handle<Object> fun1 = Object::GetProperty(
+      isolate->global_object(), foo_string);
   CHECK(fun1->IsJSFunction());

   Handle<Object> argv[] = { isolate->factory()->InternalizeOneByteString(
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Tue Apr 8 07:54:27 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap.cc Wed Apr 9 12:21:47 2014 UTC
@@ -293,8 +293,8 @@
     JSReceiver::SetProperty(
         obj, prop_namex, twenty_four, NONE, SLOPPY).Check();

-    CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
-    CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
+    CHECK_EQ(Smi::FromInt(23), *Object::GetProperty(obj, prop_name));
+    CHECK_EQ(Smi::FromInt(24), *Object::GetProperty(obj, prop_namex));
   }

   heap->CollectGarbage(NEW_SPACE);
@@ -302,10 +302,9 @@
   // Function should be alive.
   CHECK(JSReceiver::HasLocalProperty(global, name));
   // Check function is retained.
-  Object* func_value = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*name)->ToObjectChecked();
+  Handle<Object> func_value = Object::GetProperty(global, name);
   CHECK(func_value->IsJSFunction());
-  Handle<JSFunction> function(JSFunction::cast(func_value));
+  Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);

   {
     HandleScope inner_scope(isolate);
@@ -320,12 +319,9 @@
   heap->CollectGarbage(NEW_SPACE);

   CHECK(JSReceiver::HasLocalProperty(global, obj_name));
-  CHECK(CcTest::i_isolate()->context()->global_object()->
-        GetProperty(*obj_name)->ToObjectChecked()->IsJSObject());
-  Object* obj = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*obj_name)->ToObjectChecked();
-  JSObject* js_obj = JSObject::cast(obj);
-  CHECK_EQ(Smi::FromInt(23), js_obj->GetProperty(*prop_name));
+  Handle<Object> obj = Object::GetProperty(global, obj_name);
+  CHECK(obj->IsJSObject());
+  CHECK_EQ(Smi::FromInt(23), *Object::GetProperty(obj, prop_name));
 }


@@ -649,11 +645,11 @@
   Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
   Handle<JSObject> obj = factory->NewJSObject(function);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
-  CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
+  CHECK_EQ(Smi::FromInt(23), *Object::GetProperty(obj, prop_name));
   // Check that we can add properties to function objects.
   JSReceiver::SetProperty(
       function, prop_name, twenty_four, NONE, SLOPPY).Check();
-  CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
+  CHECK_EQ(Smi::FromInt(24), *Object::GetProperty(function, prop_name));
 }


@@ -663,11 +659,10 @@
   Factory* factory = isolate->factory();

   v8::HandleScope sc(CcTest::isolate());
-  String* object_string = String::cast(CcTest::heap()->Object_string());
-  Object* raw_object = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(object_string)->ToObjectChecked();
-  JSFunction* object_function = JSFunction::cast(raw_object);
-  Handle<JSFunction> constructor(object_function);
+ Handle<String> object_string(String::cast(CcTest::heap()->Object_string()));
+  Handle<Object> object =
+ Object::GetProperty(CcTest::i_isolate()->global_object(), object_string);
+  Handle<JSFunction> constructor = Handle<JSFunction>::cast(object);
   Handle<JSObject> obj = factory->NewJSObject(constructor);
   Handle<String> first = factory->InternalizeUtf8String("first");
   Handle<String> second = factory->InternalizeUtf8String("second");
@@ -747,7 +742,7 @@
   // Set a propery
   Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
-  CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
+  CHECK_EQ(Smi::FromInt(23), *Object::GetProperty(obj, prop_name));

   // Check the map has changed
   CHECK(*initial_map != obj->map());
@@ -761,10 +756,9 @@

   v8::HandleScope sc(CcTest::isolate());
   Handle<String> name = factory->InternalizeUtf8String("Array");
-  Object* raw_object = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*name)->ToObjectChecked();
-  Handle<JSFunction> function = Handle<JSFunction>(
-      JSFunction::cast(raw_object));
+  Handle<Object> fun_obj =
+      Object::GetProperty(CcTest::i_isolate()->global_object(), name);
+  Handle<JSFunction> function = Handle<JSFunction>::cast(fun_obj);

   // Allocate the object.
   Handle<JSObject> object = factory->NewJSObject(function);
@@ -809,11 +803,10 @@
   Factory* factory = isolate->factory();

   v8::HandleScope sc(CcTest::isolate());
-  String* object_string = String::cast(CcTest::heap()->Object_string());
-  Object* raw_object = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(object_string)->ToObjectChecked();
-  JSFunction* object_function = JSFunction::cast(raw_object);
-  Handle<JSFunction> constructor(object_function);
+ Handle<String> object_string(String::cast(CcTest::heap()->Object_string()));
+  Handle<Object> object =
+ Object::GetProperty(CcTest::i_isolate()->global_object(), object_string);
+  Handle<JSFunction> constructor = Handle<JSFunction>::cast(object);
   Handle<JSObject> obj = factory->NewJSObject(constructor);
   Handle<String> first = factory->InternalizeUtf8String("first");
   Handle<String> second = factory->InternalizeUtf8String("second");
@@ -836,8 +829,10 @@
   CHECK_EQ(*i::Object::GetElement(isolate, obj, 1),
            *i::Object::GetElement(isolate, clone, 1));

-  CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first));
-  CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
+  CHECK_EQ(*Object::GetProperty(obj, first),
+           *Object::GetProperty(clone, first));
+  CHECK_EQ(*Object::GetProperty(obj, second),
+           *Object::GetProperty(clone, second));

   // Flip the values.
   JSReceiver::SetProperty(clone, first, two, NONE, SLOPPY).Check();
@@ -851,8 +846,10 @@
   CHECK_EQ(*i::Object::GetElement(isolate, obj, 0),
            *i::Object::GetElement(isolate, clone, 1));

-  CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first));
-  CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second));
+  CHECK_EQ(*Object::GetProperty(obj, second),
+           *Object::GetProperty(clone, first));
+  CHECK_EQ(*Object::GetProperty(obj, first),
+           *Object::GetProperty(clone, second));
 }


@@ -1071,10 +1068,10 @@
   }

   // Check function is compiled.
-  Object* func_value = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*foo_name)->ToObjectChecked();
+  Handle<Object> func_value =
+      Object::GetProperty(CcTest::i_isolate()->global_object(), foo_name);
   CHECK(func_value->IsJSFunction());
-  Handle<JSFunction> function(JSFunction::cast(func_value));
+  Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);
   CHECK(function->shared()->is_compiled());

   // The code will survive at least two GCs.
@@ -1104,7 +1101,7 @@
   i::FLAG_allow_natives_syntax = true;
   i::FLAG_optimize_for_size = true;
   CcTest::InitializeVM();
-  Isolate* isolate = Isolate::Current();
+  Isolate* isolate = CcTest::i_isolate();
   Factory* factory = isolate->factory();
   v8::HandleScope scope(CcTest::isolate());
   const char* source = "function foo() {"
@@ -1121,10 +1118,10 @@
   }

   // Check function is compiled.
-  Object* func_value = Isolate::Current()->context()->global_object()->
-      GetProperty(*foo_name)->ToObjectChecked();
+  Handle<Object> func_value =
+      Object::GetProperty(isolate->global_object(), foo_name);
   CHECK(func_value->IsJSFunction());
-  Handle<JSFunction> function(JSFunction::cast(func_value));
+  Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);
   CHECK(function->shared()->is_compiled());

   // The code has been run so will survive at least one GC.
@@ -1186,10 +1183,10 @@
   }

   // Check function is compiled.
-  Object* func_value = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*foo_name)->ToObjectChecked();
+  Handle<Object> func_value =
+      Object::GetProperty(isolate->global_object(), foo_name);
   CHECK(func_value->IsJSFunction());
-  Handle<JSFunction> function(JSFunction::cast(func_value));
+  Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);
   CHECK(function->shared()->is_compiled());

   // The code will survive at least two GCs.
@@ -1263,15 +1260,15 @@
   }

   // Check functions are compiled.
-  Object* func_value = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*foo_name)->ToObjectChecked();
+  Handle<Object> func_value =
+      Object::GetProperty(isolate->global_object(), foo_name);
   CHECK(func_value->IsJSFunction());
-  Handle<JSFunction> function(JSFunction::cast(func_value));
+  Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);
   CHECK(function->shared()->is_compiled());
-  Object* func_value2 = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*bar_name)->ToObjectChecked();
+  Handle<Object> func_value2 =
+      Object::GetProperty(isolate->global_object(), bar_name);
   CHECK(func_value2->IsJSFunction());
-  Handle<JSFunction> function2(JSFunction::cast(func_value2));
+  Handle<JSFunction> function2 = Handle<JSFunction>::cast(func_value2);
   CHECK(function2->shared()->is_compiled());

   // Clear references to functions so that one of them can die.
@@ -1325,10 +1322,10 @@
   }

   // Check function is compiled.
-  Object* func_value = CcTest::i_isolate()->context()->global_object()->
-      GetProperty(*foo_name)->ToObjectChecked();
+  Handle<Object> func_value =
+      Object::GetProperty(isolate->global_object(), foo_name);
   CHECK(func_value->IsJSFunction());
-  Handle<JSFunction> function(JSFunction::cast(func_value));
+  Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);
   CHECK(function->shared()->is_compiled());

   // The code will survive at least two GCs.
=======================================
--- /branches/bleeding_edge/test/cctest/test-mark-compact.cc Mon Apr 7 10:24:01 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-mark-compact.cc Wed Apr 9 12:21:47 2014 UTC
@@ -128,6 +128,7 @@
   CcTest::InitializeVM();
   Isolate* isolate = CcTest::i_isolate();
   Heap* heap = isolate->heap();
+  Factory* factory = isolate->factory();

   v8::HandleScope sc(CcTest::isolate());
   Handle<GlobalObject> global(isolate->context()->global_object());
@@ -143,70 +144,57 @@
     maybe_array = heap->AllocateFixedArray(ARRAY_SIZE);
   } while (maybe_array->ToObject(&array));
   heap->CollectGarbage(NEW_SPACE, "trigger 2");
-
-  array = heap->AllocateFixedArray(ARRAY_SIZE)->ToObjectChecked();
+  heap->AllocateFixedArray(ARRAY_SIZE)->ToObjectChecked();

   // keep allocating maps until it fails
-  Object* mapp;
-  MaybeObject* maybe_mapp;
+  Object* map;
+  MaybeObject* maybe_map;
   do {
-    maybe_mapp = heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
-  } while (maybe_mapp->ToObject(&mapp));
+    maybe_map = heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
+  } while (maybe_map->ToObject(&map));
   heap->CollectGarbage(MAP_SPACE, "trigger 3");
-  mapp = heap->AllocateMap(JS_OBJECT_TYPE,
-                           JSObject::kHeaderSize)->ToObjectChecked();
+ heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize)->ToObjectChecked();

-  // allocate a garbage
-  String* func_name = String::cast(
-      heap->InternalizeUtf8String("theFunction")->ToObjectChecked());
-  SharedFunctionInfo* function_share = SharedFunctionInfo::cast(
-      heap->AllocateSharedFunctionInfo(func_name)->ToObjectChecked());
-  JSFunction* function = JSFunction::cast(
-      heap->AllocateFunction(*isolate->sloppy_function_map(),
-                             function_share,
-                             heap->undefined_value())->ToObjectChecked());
-  Map* initial_map =
-      Map::cast(heap->AllocateMap(JS_OBJECT_TYPE,
- JSObject::kHeaderSize)->ToObjectChecked());
-  function->set_initial_map(initial_map);
-  JSReceiver::SetProperty(
-      global, handle(func_name), handle(function), NONE, SLOPPY).Check();
+  { HandleScope scope(isolate);
+    // allocate a garbage
+ Handle<String> func_name = factory->InternalizeUtf8String("theFunction");
+    Handle<JSFunction> function = factory->NewFunction(
+        func_name, factory->undefined_value());
+    Handle<Map> initial_map = factory->NewMap(
+        JS_OBJECT_TYPE, JSObject::kHeaderSize);
+    function->set_initial_map(*initial_map);
+ JSReceiver::SetProperty(global, func_name, function, NONE, SLOPPY).Check();

-  JSObject* obj = JSObject::cast(
-      heap->AllocateJSObject(function)->ToObjectChecked());
+    factory->NewJSObject(function);
+  }
+
   heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 4");

-  func_name = String::cast(
-      heap->InternalizeUtf8String("theFunction")->ToObjectChecked());
-  CHECK(JSReceiver::HasLocalProperty(global, handle(func_name)));
-  Object* func_value = isolate->context()->global_object()->
-      GetProperty(func_name)->ToObjectChecked();
-  CHECK(func_value->IsJSFunction());
-  function = JSFunction::cast(func_value);
+  { HandleScope scope(isolate);
+ Handle<String> func_name = factory->InternalizeUtf8String("theFunction");
+    CHECK(JSReceiver::HasLocalProperty(global, func_name));
+    Handle<Object> func_value = Object::GetProperty(global, func_name);
+    CHECK(func_value->IsJSFunction());
+    Handle<JSFunction> function = Handle<JSFunction>::cast(func_value);
+    Handle<JSObject> obj = factory->NewJSObject(function);

- obj = JSObject::cast(heap->AllocateJSObject(function)->ToObjectChecked());
-  String* obj_name =
- String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked());
-  JSReceiver::SetProperty(
-      global, handle(obj_name), handle(obj), NONE, SLOPPY).Check();
-  String* prop_name =
- String::cast(heap->InternalizeUtf8String("theSlot")->ToObjectChecked());
-  Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
-  JSReceiver::SetProperty(
-      handle(obj), handle(prop_name), twenty_three, NONE, SLOPPY).Check();
+    Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
+    JSReceiver::SetProperty(global, obj_name, obj, NONE, SLOPPY).Check();
+    Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
+    Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
+ JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, SLOPPY).Check();
+  }

   heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5");

-  obj_name =
- String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked());
-  CHECK(JSReceiver::HasLocalProperty(global, handle(obj_name)));
-  CHECK(isolate->context()->global_object()->
-        GetProperty(obj_name)->ToObjectChecked()->IsJSObject());
-  obj = JSObject::cast(isolate->context()->global_object()->
-                       GetProperty(obj_name)->ToObjectChecked());
-  prop_name =
- String::cast(heap->InternalizeUtf8String("theSlot")->ToObjectChecked());
-  CHECK(obj->GetProperty(prop_name) == Smi::FromInt(23));
+  { HandleScope scope(isolate);
+    Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
+    CHECK(JSReceiver::HasLocalProperty(global, obj_name));
+    Handle<Object> object = Object::GetProperty(global, obj_name);
+    CHECK(object->IsJSObject());
+    Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
+    CHECK_EQ(*Object::GetProperty(object, prop_name), Smi::FromInt(23));
+  }
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to