Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
FPIIM-449
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 914bda1..dd483c0 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -302,18 +302,6 @@
}
-static void ChangeScriptBreakPointIgnoreCountFromJS(v8::Isolate* isolate,
- int break_point_number,
- int ignoreCount) {
- EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
- SNPrintF(buffer,
- "debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)",
- break_point_number, ignoreCount);
- buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- CompileRunChecked(isolate, buffer.start());
-}
-
-
// Change break on exception.
static void ChangeBreakOnException(bool caught, bool uncaught) {
v8::internal::Debug* debug = CcTest::i_isolate()->debug();
@@ -1717,72 +1705,6 @@
}
-// Test ignore count on script break points.
-TEST(ScriptBreakPointIgnoreCount) {
- break_point_hit_count = 0;
- DebugLocalContext env;
- v8::HandleScope scope(env->GetIsolate());
- env.ExposeDebug();
-
- v8::Debug::SetDebugEventListener(env->GetIsolate(),
- DebugEventBreakPointHitCount);
-
- v8::Local<v8::String> script = v8_str(env->GetIsolate(),
- "function f() {\n"
- " a = 0; // line 1\n"
- "};");
-
- // Compile the script and get function f.
- v8::Local<v8::Context> context = env.context();
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8_str(env->GetIsolate(), "test"));
- v8::Script::Compile(context, script, &origin)
- .ToLocalChecked()
- ->Run(context)
- .ToLocalChecked();
- v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
- env->Global()
- ->Get(context, v8_str(env->GetIsolate(), "f"))
- .ToLocalChecked());
-
- // Set script break point on line 1 (in function f).
- int sbp = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 1, 0);
-
- // Call f with different ignores on the script break point.
- break_point_hit_count = 0;
- ChangeScriptBreakPointIgnoreCountFromJS(env->GetIsolate(), sbp, 1);
- f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
- CHECK_EQ(0, break_point_hit_count);
- f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
- CHECK_EQ(1, break_point_hit_count);
-
- ChangeScriptBreakPointIgnoreCountFromJS(env->GetIsolate(), sbp, 5);
- break_point_hit_count = 0;
- for (int i = 0; i < 10; i++) {
- f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
- }
- CHECK_EQ(5, break_point_hit_count);
-
- // Reload the script and get f again checking that the ignore survives.
- v8::Script::Compile(context, script, &origin)
- .ToLocalChecked()
- ->Run(context)
- .ToLocalChecked();
- f = v8::Local<v8::Function>::Cast(
- env->Global()
- ->Get(context, v8_str(env->GetIsolate(), "f"))
- .ToLocalChecked());
-
- break_point_hit_count = 0;
- for (int i = 0; i < 10; i++) {
- f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
- }
- CHECK_EQ(5, break_point_hit_count);
-
- v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
- CheckDebuggerUnloaded(env->GetIsolate());
-}
-
-
// Test that script break points survive when a script is reloaded.
TEST(ScriptBreakPointReload) {
break_point_hit_count = 0;
@@ -4405,7 +4327,6 @@
CheckDebuggerUnloaded(env->GetIsolate());
}
-
TEST(DisableDebuggerStatement) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
@@ -7396,7 +7317,7 @@
CHECK(argument_name->Equals(context, v8_str(isolate, "count"))
.FromJust());
// Get the value of the first argument in frame i. If the
- // funtion is optimized the value will be undefined, otherwise
+ // function is optimized the value will be undefined, otherwise
// the value will be '1 - i'.
//
// TODO(3141533): We should be able to get the real value for
@@ -8073,3 +7994,81 @@
v8::Debug::SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent);
CompileRun("void(0);");
}
+
+class TestBreakLocation : public i::BreakLocation {
+ public:
+ using i::BreakLocation::GetIterator;
+ using i::BreakLocation::Iterator;
+};
+
+TEST(BreakLocationIterator) {
+ DebugLocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ v8::HandleScope scope(isolate);
+
+ v8::Local<v8::Value> result = CompileRun(
+ "function f() {\n"
+ " debugger; \n"
+ " f(); \n"
+ " debugger; \n"
+ "} \n"
+ "f");
+ Handle<i::Object> function_obj = v8::Utils::OpenHandle(*result);
+ Handle<i::JSFunction> function = Handle<i::JSFunction>::cast(function_obj);
+ Handle<i::SharedFunctionInfo> shared(function->shared());
+
+ EnableDebugger(isolate);
+ CHECK(i_isolate->debug()->EnsureDebugInfo(shared, function));
+
+ Handle<i::DebugInfo> debug_info(shared->GetDebugInfo());
+ int code_size = debug_info->abstract_code()->Size();
+
+ bool found_return = false;
+ bool found_call = false;
+ bool found_debugger = false;
+
+ // Test public interface.
+ for (int i = 0; i < code_size; i++) {
+ i::BreakLocation location = i::BreakLocation::FromCodeOffset(debug_info, i);
+ if (location.IsCall()) found_call = true;
+ if (location.IsReturn()) found_return = true;
+ if (location.IsDebuggerStatement()) found_debugger = true;
+ }
+ CHECK(found_call);
+ CHECK(found_return);
+ CHECK(found_debugger);
+
+ // Test underlying implementation.
+ TestBreakLocation::Iterator* iterator =
+ TestBreakLocation::GetIterator(debug_info, i::ALL_BREAK_LOCATIONS);
+ CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
+ CHECK_EQ(7, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsDebugBreakSlot());
+ CHECK_EQ(22, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsCall());
+ CHECK_EQ(22, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
+ CHECK_EQ(37, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsReturn());
+ CHECK_EQ(50, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->Done());
+ delete iterator;
+
+ iterator = TestBreakLocation::GetIterator(debug_info, i::CALLS_AND_RETURNS);
+ CHECK(iterator->GetBreakLocation().IsCall());
+ CHECK_EQ(22, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsReturn());
+ CHECK_EQ(50, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->Done());
+ delete iterator;
+
+ DisableDebugger(isolate);
+}