Update V8 to version 4.1.0.21
This is a cherry-pick of all commits up to and including the
4.1.0.21 cherry-pick in Chromium.
Original commit message:
Version 4.1.0.21 (cherry-pick)
Merged 206e9136bde0f2b5ae8cb77afbb1e7833e5bd412
Unlink pages from the space page list after evacuation.
BUG=430201
LOG=N
R=jkummerow@chromium.org
Review URL: https://codereview.chromium.org/953813002
Cr-Commit-Position: refs/branch-heads/4.1@{#22}
Cr-Branched-From: 2e08d2a7aa9d65d269d8c57aba82eb38a8cb0a18-refs/heads/candidates@{#25353}
---
FPIIM-449
Change-Id: I8c23c7bbb70772b4858fe8a47b64fa97ee0d1f8c
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index 8f9b484..94a5be4 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -890,9 +890,10 @@
} // namespace
TEST(HeapSnapshotJSONSerialization) {
+ v8::Isolate* isolate = CcTest::isolate();
LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
- v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+ v8::HandleScope scope(isolate);
+ v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
#define STRING_LITERAL_FOR_TEST \
"\"String \\n\\r\\u0008\\u0081\\u0101\\u0801\\u8001\""
@@ -923,7 +924,7 @@
// Verify that snapshot object has required fields.
v8::Local<v8::Object> parsed_snapshot =
- env->Global()->Get(v8_str("parsed"))->ToObject();
+ env->Global()->Get(v8_str("parsed"))->ToObject(isolate);
CHECK(parsed_snapshot->Has(v8_str("snapshot")));
CHECK(parsed_snapshot->Has(v8_str("nodes")));
CHECK(parsed_snapshot->Has(v8_str("edges")));
@@ -979,17 +980,18 @@
" \"s\", property_type)");
CHECK(!string_obj_pos_val.IsEmpty());
int string_obj_pos =
- static_cast<int>(string_obj_pos_val->ToNumber()->Value());
+ static_cast<int>(string_obj_pos_val->ToNumber(isolate)->Value());
v8::Local<v8::Object> nodes_array =
- parsed_snapshot->Get(v8_str("nodes"))->ToObject();
+ parsed_snapshot->Get(v8_str("nodes"))->ToObject(isolate);
int string_index = static_cast<int>(
- nodes_array->Get(string_obj_pos + 1)->ToNumber()->Value());
+ nodes_array->Get(string_obj_pos + 1)->ToNumber(isolate)->Value());
CHECK_GT(string_index, 0);
v8::Local<v8::Object> strings_array =
- parsed_snapshot->Get(v8_str("strings"))->ToObject();
- v8::Local<v8::String> string = strings_array->Get(string_index)->ToString();
+ parsed_snapshot->Get(v8_str("strings"))->ToObject(isolate);
+ v8::Local<v8::String> string =
+ strings_array->Get(string_index)->ToString(isolate);
v8::Local<v8::String> ref_string =
- CompileRun(STRING_LITERAL_FOR_TEST)->ToString();
+ CompileRun(STRING_LITERAL_FOR_TEST)->ToString(isolate);
#undef STRING_LITERAL_FOR_TEST
CHECK_EQ(*v8::String::Utf8Value(ref_string),
*v8::String::Utf8Value(string));
@@ -1719,9 +1721,6 @@
const v8::HeapGraphNode* native_context =
GetProperty(global, v8::HeapGraphEdge::kInternal, "native_context");
CHECK_NE(NULL, native_context);
- const v8::HeapGraphNode* global_context =
- GetProperty(global, v8::HeapGraphEdge::kInternal, "global_context");
- CHECK_NE(NULL, global_context);
const v8::HeapGraphNode* global_proxy =
GetProperty(global, v8::HeapGraphEdge::kInternal, "global_proxy");
CHECK_NE(NULL, global_proxy);
@@ -1917,6 +1916,47 @@
}
+TEST(FastCaseRedefinedAccessors) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ CompileRun(
+ "var obj1 = {};\n"
+ "Object.defineProperty(obj1, 'prop', { "
+ " get: function() { return 42; },\n"
+ " set: function(value) { return this.prop_ = value; },\n"
+ " configurable: true,\n"
+ " enumerable: true,\n"
+ "});\n"
+ "Object.defineProperty(obj1, 'prop', { "
+ " get: function() { return 153; },\n"
+ " set: function(value) { return this.prop_ = value; },\n"
+ " configurable: true,\n"
+ " enumerable: true,\n"
+ "});\n");
+ v8::Local<v8::Object> js_global =
+ env->Global()->GetPrototype().As<v8::Object>();
+ i::Handle<i::JSObject> js_obj1 =
+ v8::Utils::OpenHandle(*js_global->Get(v8_str("obj1")).As<v8::Object>());
+ USE(js_obj1);
+
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("fastCaseAccessors"));
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ CHECK_NE(NULL, global);
+ const v8::HeapGraphNode* obj1 =
+ GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
+ CHECK_NE(NULL, obj1);
+ const v8::HeapGraphNode* func;
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get prop");
+ CHECK_NE(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set prop");
+ CHECK_NE(NULL, func);
+}
+
+
TEST(SlowCaseAccessors) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
@@ -1952,9 +1992,10 @@
TEST(HiddenPropertiesFastCase) {
+ v8::Isolate* isolate = CcTest::isolate();
LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
- v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+ v8::HandleScope scope(isolate);
+ v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
CompileRun(
"function C(x) { this.a = this; this.b = x; }\n"
@@ -1973,7 +2014,7 @@
v8::Handle<v8::Value> cHandle =
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c"));
CHECK(!cHandle.IsEmpty() && cHandle->IsObject());
- cHandle->ToObject()->SetHiddenValue(v8_str("key"), v8_str("val"));
+ cHandle->ToObject(isolate)->SetHiddenValue(v8_str("key"), v8_str("val"));
snapshot = heap_profiler->TakeHeapSnapshot(
v8_str("HiddenPropertiesFastCase2"));