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

Unified Diff: test/cctest/test-heap.cc

Issue 1413463006: Map v8::Object to v8::internal::JSReceiver (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 1 month 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: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 945d0cded576cdebbd5580a357bc3f35cc9444de..0882424c038d3b9d805d0ceb425f95e3edf68ac0 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2618,10 +2618,8 @@ TEST(PrototypeTransitionClearing) {
v8::HandleScope scope(CcTest::isolate());
CompileRun("var base = {};");
- Handle<JSObject> baseObject =
- v8::Utils::OpenHandle(
- *v8::Handle<v8::Object>::Cast(
- CcTest::global()->Get(v8_str("base"))));
+ Handle<JSReceiver> baseObject = v8::Utils::OpenHandle(
+ *v8::Handle<v8::Object>::Cast(CcTest::global()->Get(v8_str("base"))));
int initialTransitions = NumberOfProtoTransitions(baseObject->map());
CompileRun(
@@ -2851,7 +2849,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
CHECK_EQ(
4, res.As<v8::Object>()->GetRealNamedProperty(v8_str("x"))->Int32Value());
- Handle<JSObject> o =
+ Handle<JSReceiver> o =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
CHECK(CcTest::heap()->InNewSpace(*o));
@@ -2891,13 +2889,13 @@ TEST(OptimizedPretenuringAllocationFolding) {
v8::Local<v8::Value> res = CompileRun(source.start());
v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0"));
- Handle<JSObject> int_array_handle =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array));
+ Handle<JSObject> int_array_handle = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)));
v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1"));
- Handle<JSObject> double_array_handle =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array));
+ Handle<JSObject> double_array_handle = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array)));
- Handle<JSObject> o =
+ Handle<JSReceiver> o =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*int_array_handle));
@@ -2939,8 +2937,8 @@ TEST(OptimizedPretenuringObjectArrayLiterals) {
v8::Local<v8::Value> res = CompileRun(source.start());
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(o->elements()));
CHECK(CcTest::heap()->InOldSpace(*o));
@@ -2980,8 +2978,8 @@ TEST(OptimizedPretenuringMixedInObjectProperties) {
v8::Local<v8::Value> res = CompileRun(source.start());
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
FieldIndex idx1 = FieldIndex::ForPropertyIndex(o->map(), 0);
@@ -3037,8 +3035,8 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
v8::Local<v8::Value> res = CompileRun(source.start());
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(o->properties()));
@@ -3077,8 +3075,8 @@ TEST(OptimizedPretenuringdoubleArrayLiterals) {
v8::Local<v8::Value> res = CompileRun(source.start());
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(o->elements()));
CHECK(CcTest::heap()->InOldSpace(*o));
@@ -3117,14 +3115,14 @@ TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
v8::Local<v8::Value> res = CompileRun(source.start());
v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0"));
- Handle<JSObject> int_array_handle =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array));
+ Handle<JSObject> int_array_handle = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)));
v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1"));
- Handle<JSObject> double_array_handle =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array));
+ Handle<JSObject> double_array_handle = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array)));
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*int_array_handle));
CHECK(CcTest::heap()->InOldSpace(int_array_handle->elements()));
@@ -3166,14 +3164,14 @@ TEST(OptimizedPretenuringNestedObjectLiterals) {
v8::Local<v8::Value> res = CompileRun(source.start());
v8::Local<v8::Value> int_array_1 = v8::Object::Cast(*res)->Get(v8_str("0"));
- Handle<JSObject> int_array_handle_1 =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array_1));
+ Handle<JSObject> int_array_handle_1 = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array_1)));
v8::Local<v8::Value> int_array_2 = v8::Object::Cast(*res)->Get(v8_str("1"));
- Handle<JSObject> int_array_handle_2 =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array_2));
+ Handle<JSObject> int_array_handle_2 = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array_2)));
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*int_array_handle_1));
CHECK(CcTest::heap()->InOldSpace(int_array_handle_1->elements()));
@@ -3216,15 +3214,15 @@ TEST(OptimizedPretenuringNestedDoubleLiterals) {
v8::Local<v8::Value> double_array_1 =
v8::Object::Cast(*res)->Get(v8_str("0"));
- Handle<JSObject> double_array_handle_1 =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array_1));
+ Handle<JSObject> double_array_handle_1 = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array_1)));
v8::Local<v8::Value> double_array_2 =
v8::Object::Cast(*res)->Get(v8_str("1"));
- Handle<JSObject> double_array_handle_2 =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array_2));
+ Handle<JSObject> double_array_handle_2 = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array_2)));
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(*o));
CHECK(CcTest::heap()->InOldSpace(*double_array_handle_1));
CHECK(CcTest::heap()->InOldSpace(double_array_handle_1->elements()));
@@ -3253,8 +3251,8 @@ TEST(OptimizedAllocationArrayLiterals) {
CHECK_EQ(static_cast<int>(3.14),
v8::Object::Cast(*res)->Get(v8_str("0"))->Int32Value());
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InNewSpace(o->elements()));
}
@@ -3287,10 +3285,8 @@ TEST(Regress1465) {
CompileRun("var root = new F;");
}
- Handle<JSObject> root =
- v8::Utils::OpenHandle(
- *v8::Handle<v8::Object>::Cast(
- CcTest::global()->Get(v8_str("root"))));
+ Handle<JSReceiver> root = v8::Utils::OpenHandle(
+ *v8::Handle<v8::Object>::Cast(CcTest::global()->Get(v8_str("root"))));
// Count number of live transitions before marking.
int transitions_before = CountMapTransitions(root->map());
@@ -3320,9 +3316,8 @@ static void AddTransitions(int transitions_count) {
static Handle<JSObject> GetByName(const char* name) {
- return v8::Utils::OpenHandle(
- *v8::Handle<v8::Object>::Cast(
- CcTest::global()->Get(v8_str(name))));
+ return Handle<JSObject>::cast(v8::Utils::OpenHandle(
+ *v8::Handle<v8::Object>::Cast(CcTest::global()->Get(v8_str(name)))));
}
@@ -3482,10 +3477,8 @@ TEST(Regress2143a) {
// Explicitly request GC to perform final marking step and sweeping.
CcTest::heap()->CollectAllGarbage();
- Handle<JSObject> root =
- v8::Utils::OpenHandle(
- *v8::Handle<v8::Object>::Cast(
- CcTest::global()->Get(v8_str("root"))));
+ Handle<JSReceiver> root = v8::Utils::OpenHandle(
+ *v8::Handle<v8::Object>::Cast(CcTest::global()->Get(v8_str("root"))));
// The root object should be in a sane state.
CHECK(root->IsJSObject());
@@ -3525,10 +3518,8 @@ TEST(Regress2143b) {
// Explicitly request GC to perform final marking step and sweeping.
CcTest::heap()->CollectAllGarbage();
- Handle<JSObject> root =
- v8::Utils::OpenHandle(
- *v8::Handle<v8::Object>::Cast(
- CcTest::global()->Get(v8_str("root"))));
+ Handle<JSReceiver> root = v8::Utils::OpenHandle(
+ *v8::Handle<v8::Object>::Cast(CcTest::global()->Get(v8_str("root"))));
// The root object should be in a sane state.
CHECK(root->IsJSObject());
@@ -3725,7 +3716,7 @@ TEST(ICInBuiltInIsClearedAppropriately) {
{
LocalContext env;
v8::Local<v8::Value> res = CompileRun("Function.apply");
- Handle<JSObject> maybe_apply =
+ Handle<JSReceiver> maybe_apply =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
apply = Handle<JSFunction>::cast(maybe_apply);
Handle<TypeFeedbackVector> vector(apply->shared()->feedback_vector());
@@ -5473,8 +5464,8 @@ TEST(ArrayShiftSweeping) {
"array.shift();"
"array;");
- Handle<JSObject> o =
- v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
+ Handle<JSObject> o = Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)));
CHECK(heap->InOldSpace(o->elements()));
CHECK(heap->InOldSpace(*o));
Page* page = Page::FromAddress(o->elements()->address());
@@ -5622,7 +5613,7 @@ TEST(Regress3631) {
CcTest::heap()->StartIncrementalMarking();
}
// Incrementally mark the backing store.
- Handle<JSObject> obj =
+ Handle<JSReceiver> obj =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj));
while (!Marking::IsBlack(
@@ -5682,7 +5673,7 @@ TEST(Regress3877) {
{
HandleScope inner_scope(isolate);
v8::Local<v8::Value> result = CompileRun("cls.prototype");
- Handle<JSObject> proto =
+ Handle<JSReceiver> proto =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
weak_prototype = inner_scope.CloseAndEscape(factory->NewWeakCell(proto));
}
@@ -5710,7 +5701,7 @@ Handle<WeakCell> AddRetainedMap(Isolate* isolate, Heap* heap) {
Handle<Map> map = Map::Create(isolate, 1);
v8::Local<v8::Value> result =
CompileRun("(function () { return {x : 10}; })();");
- Handle<JSObject> proto =
+ Handle<JSReceiver> proto =
v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result));
Map::SetPrototype(map, proto);
heap->AddRetainedMap(map);

Powered by Google App Engine
This is Rietveld 408576698