Revert "Pull from svn bleeding_edge@3716"
This reverts commit 888f6729be6a6f6fbe246cb5a9f122e2dbe455b7.
(Waiting until v8 issue 554101 is in v8 rather than patching it straight into
android)
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index a00097b..7e67c00 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -61,27 +61,6 @@
namespace i = ::v8::internal;
-static void ExpectString(const char* code, const char* expected) {
- Local<Value> result = CompileRun(code);
- CHECK(result->IsString());
- String::AsciiValue ascii(result);
- CHECK_EQ(expected, *ascii);
-}
-
-
-static void ExpectBoolean(const char* code, bool expected) {
- Local<Value> result = CompileRun(code);
- CHECK(result->IsBoolean());
- CHECK_EQ(expected, result->BooleanValue());
-}
-
-
-static void ExpectObject(const char* code, Local<Value> expected) {
- Local<Value> result = CompileRun(code);
- CHECK(result->Equals(expected));
-}
-
-
static int signature_callback_count;
static v8::Handle<Value> IncrementingSignatureCallback(
const v8::Arguments& args) {
@@ -2402,36 +2381,6 @@
}
-static v8::Handle<Value> IdentityIndexedPropertyGetter(
- uint32_t index,
- const AccessorInfo& info) {
- return v8::Integer::New(index);
-}
-
-
-THREADED_TEST(IndexedInterceptorWithNoSetter) {
- v8::HandleScope scope;
- Local<ObjectTemplate> templ = ObjectTemplate::New();
- templ->SetIndexedPropertyHandler(IdentityIndexedPropertyGetter);
-
- LocalContext context;
- context->Global()->Set(v8_str("obj"), templ->NewInstance());
-
- const char* code =
- "try {"
- " obj[0] = 239;"
- " for (var i = 0; i < 100; i++) {"
- " var v = obj[0];"
- " if (v != 0) throw 'Wrong value ' + v + ' at iteration ' + i;"
- " }"
- " 'PASSED'"
- "} catch(e) {"
- " e"
- "}";
- ExpectString(code, "PASSED");
-}
-
-
THREADED_TEST(MultiContexts) {
v8::HandleScope scope;
v8::Handle<ObjectTemplate> templ = ObjectTemplate::New();
@@ -2518,6 +2467,27 @@
}
+static void ExpectString(const char* code, const char* expected) {
+ Local<Value> result = CompileRun(code);
+ CHECK(result->IsString());
+ String::AsciiValue ascii(result);
+ CHECK_EQ(0, strcmp(*ascii, expected));
+}
+
+
+static void ExpectBoolean(const char* code, bool expected) {
+ Local<Value> result = CompileRun(code);
+ CHECK(result->IsBoolean());
+ CHECK_EQ(expected, result->BooleanValue());
+}
+
+
+static void ExpectObject(const char* code, Local<Value> expected) {
+ Local<Value> result = CompileRun(code);
+ CHECK(result->Equals(expected));
+}
+
+
THREADED_TEST(UndetectableObject) {
v8::HandleScope scope;
LocalContext env;
@@ -2869,16 +2839,12 @@
static const char* exts[1] = { "functiontest" };
v8::ExtensionConfiguration config(1, exts);
LocalContext context(&config);
- for (int i = 0; i < 10; i++) {
- // Run a few times to ensure that allocation of objects doesn't
- // change behavior of a constructor function.
- CHECK_EQ(v8::Integer::New(8),
- Script::Compile(v8_str("(new A()).data"))->Run());
- CHECK_EQ(v8::Integer::New(7),
- Script::Compile(v8_str("(new B()).data"))->Run());
- CHECK_EQ(v8::Integer::New(6),
- Script::Compile(v8_str("(new C()).data"))->Run());
- }
+ CHECK_EQ(v8::Integer::New(8),
+ Script::Compile(v8_str("(new A()).data"))->Run());
+ CHECK_EQ(v8::Integer::New(7),
+ Script::Compile(v8_str("(new B()).data"))->Run());
+ CHECK_EQ(v8::Integer::New(6),
+ Script::Compile(v8_str("(new C()).data"))->Run());
}
@@ -6236,16 +6202,8 @@
}
-static int GetGlobalObjectsCount() {
- int count = 0;
- v8::internal::HeapIterator it;
- for (i::HeapObject* object = it.next(); object != NULL; object = it.next())
- if (object->IsJSGlobalObject()) count++;
- return count;
-}
-
-
static int GetSurvivingGlobalObjectsCount() {
+ int count = 0;
// We need to collect all garbage twice to be sure that everything
// has been collected. This is because inline caches are cleared in
// the first garbage collection but some of the maps have already
@@ -6253,7 +6211,13 @@
// collected until the second garbage collection.
v8::internal::Heap::CollectAllGarbage(false);
v8::internal::Heap::CollectAllGarbage(false);
- int count = GetGlobalObjectsCount();
+ v8::internal::HeapIterator it;
+ while (it.has_next()) {
+ v8::internal::HeapObject* object = it.next();
+ if (object->IsJSGlobalObject()) {
+ count++;
+ }
+ }
#ifdef DEBUG
if (count > 0) v8::internal::Heap::TracePathToGlobal();
#endif
@@ -8623,6 +8587,17 @@
}
+static int GetGlobalObjectsCount() {
+ int count = 0;
+ v8::internal::HeapIterator it;
+ while (it.has_next()) {
+ v8::internal::HeapObject* object = it.next();
+ if (object->IsJSGlobalObject()) count++;
+ }
+ return count;
+}
+
+
TEST(Regress528) {
v8::V8::Initialize();