Browse Source

deps: upgrade v8 to 4.2.77.15

This includes the out-of-tree patch (but fixed in upstream HEAD) from
commit 41c00a2 ("deps: enable v8 postmortem debugging again".)

PR-URL: https://github.com/iojs/io.js/pull/1399
Reviewed-By: Fedor Indutny <fedor@indutny.com>
v2.0.2
Ben Noordhuis 10 years ago
committed by Chris Dickinson
parent
commit
01e6632d70
  1. 2
      deps/v8/include/v8-version.h
  2. 46
      deps/v8/src/api-natives.cc
  3. 2
      deps/v8/src/api-natives.h
  4. 4
      deps/v8/src/bootstrapper.cc
  5. 2
      deps/v8/src/contexts.h
  6. 3
      deps/v8/src/type-info.cc
  7. 16
      deps/v8/test/cctest/test-api.cc
  8. 18
      deps/v8/tools/testrunner/local/progress.py

2
deps/v8/include/v8-version.h

@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4 #define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 2 #define V8_MINOR_VERSION 2
#define V8_BUILD_NUMBER 77 #define V8_BUILD_NUMBER 77
#define V8_PATCH_LEVEL 13 #define V8_PATCH_LEVEL 15
// Use 1 for candidates and 0 otherwise. // Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.) // (Boolean macro values are not supported by all preprocessors.)

46
deps/v8/src/api-natives.cc

@ -207,36 +207,33 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
} }
void InstallInCache(Isolate* isolate, int serial_number, void CacheFunction(Isolate* isolate, Handle<Smi> serial_number,
Handle<JSFunction> function) { Handle<JSFunction> function) {
auto cache = isolate->function_cache(); auto cache = isolate->function_cache();
if (cache->length() <= serial_number) { auto new_cache = ObjectHashTable::Put(cache, serial_number, function);
int new_size; isolate->native_context()->set_function_cache(*new_cache);
if (isolate->next_serial_number() < 50) { }
new_size = 100;
} else {
new_size = 3 * isolate->next_serial_number() / 2; void UncacheFunction(Isolate* isolate, Handle<Smi> serial_number) {
} auto cache = isolate->function_cache();
cache = FixedArray::CopySize(cache, new_size); bool was_present = false;
isolate->native_context()->set_function_cache(*cache); auto new_cache = ObjectHashTable::Remove(cache, serial_number, &was_present);
} DCHECK(was_present);
cache->set(serial_number, *function); isolate->native_context()->set_function_cache(*new_cache);
} }
MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate, MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
Handle<FunctionTemplateInfo> data, Handle<FunctionTemplateInfo> data,
Handle<Name> name) { Handle<Name> name) {
int serial_number = Smi::cast(data->serial_number())->value(); auto serial_number = handle(Smi::cast(data->serial_number()), isolate);
// Probe cache. // Probe cache.
if (!data->do_not_cache()) { if (!data->do_not_cache()) {
auto cache = isolate->function_cache(); auto cache = isolate->function_cache();
// Fast case: see if the function has already been instantiated Object* element = cache->Lookup(serial_number);
if (serial_number < cache->length()) { if (element->IsJSFunction()) {
Handle<Object> element = FixedArray::get(cache, serial_number); return handle(JSFunction::cast(element), isolate);
if (element->IsJSFunction()) {
return Handle<JSFunction>::cast(element);
}
} }
} }
// Enter a new scope. Recursion could otherwise create a lot of handles. // Enter a new scope. Recursion could otherwise create a lot of handles.
@ -279,15 +276,14 @@ MaybeHandle<JSFunction> InstantiateFunction(Isolate* isolate,
function->shared()->set_name(*name); function->shared()->set_name(*name);
} }
if (!data->do_not_cache()) { if (!data->do_not_cache()) {
// Cache the function to limit recursion. // Cache the function.
InstallInCache(isolate, serial_number, function); CacheFunction(isolate, serial_number, function);
} }
auto result = ConfigureInstance(isolate, function, data); auto result = ConfigureInstance(isolate, function, data);
if (result.is_null()) { if (result.is_null()) {
// uncache on error. // Uncache on error.
if (!data->do_not_cache()) { if (!data->do_not_cache()) {
auto cache = isolate->function_cache(); UncacheFunction(isolate, serial_number);
cache->set(serial_number, isolate->heap()->undefined_value());
} }
return MaybeHandle<JSFunction>(); return MaybeHandle<JSFunction>();
} }

2
deps/v8/src/api-natives.h

@ -12,6 +12,8 @@ namespace internal {
class ApiNatives { class ApiNatives {
public: public:
static const int kInitialFunctionCacheSize = 256;
MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction( MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction(
Handle<FunctionTemplateInfo> data); Handle<FunctionTemplateInfo> data);

4
deps/v8/src/bootstrapper.cc

@ -2059,7 +2059,9 @@ bool Genesis::InstallNatives() {
InstallNativeFunctions(); InstallNativeFunctions();
native_context()->set_function_cache(heap()->empty_fixed_array()); auto function_cache =
ObjectHashTable::New(isolate(), ApiNatives::kInitialFunctionCacheSize);
native_context()->set_function_cache(*function_cache);
// Store the map for the string prototype after the natives has been compiled // Store the map for the string prototype after the natives has been compiled
// and the String function has been set up. // and the String function has been set up.

2
deps/v8/src/contexts.h

@ -138,7 +138,7 @@ enum BindingFlags {
V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \ V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \
V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \ V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \
V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \ V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \
V(FUNCTION_CACHE_INDEX, FixedArray, function_cache) \ V(FUNCTION_CACHE_INDEX, ObjectHashTable, function_cache) \
V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \ V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \
V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \ V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \
V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \ V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \

3
deps/v8/src/type-info.cc

@ -437,6 +437,9 @@ bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
} }
constructor = map->constructor(); constructor = map->constructor();
if (constructor->IsNull()) return false; if (constructor->IsNull()) return false;
// If the constructor is not null or a JSFunction, we have to conservatively
// assume that it may retain a native context.
if (!constructor->IsJSFunction()) return true;
JSFunction* function = JSFunction::cast(constructor); JSFunction* function = JSFunction::cast(constructor);
return CanRetainOtherContext(function, native_context); return CanRetainOtherContext(function, native_context);
} }

16
deps/v8/test/cctest/test-api.cc

@ -20367,15 +20367,15 @@ THREADED_TEST(FunctionNew) {
env->Global()->Set(v8_str("func"), func); env->Global()->Set(v8_str("func"), func);
Local<Value> result = CompileRun("func();"); Local<Value> result = CompileRun("func();");
CHECK(v8::Integer::New(isolate, 17)->Equals(result)); CHECK(v8::Integer::New(isolate, 17)->Equals(result));
// Verify function not cached
int serial_number =
i::Smi::cast(v8::Utils::OpenHandle(*func)
->shared()->get_api_func_data()->serial_number())->value();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::FixedArray> cache(i_isolate->native_context()->function_cache()); // Verify function not cached
if (serial_number < cache->length()) { auto serial_number = handle(i::Smi::cast(v8::Utils::OpenHandle(*func)
CHECK(cache->get(serial_number)->IsUndefined()); ->shared()
} ->get_api_func_data()
->serial_number()),
i_isolate);
auto cache = i_isolate->function_cache();
CHECK(cache->Lookup(serial_number)->IsTheHole());
// Verify that each Function::New creates a new function instance // Verify that each Function::New creates a new function instance
Local<Object> data2 = v8::Object::New(isolate); Local<Object> data2 = v8::Object::New(isolate);
function_new_expected_env = data2; function_new_expected_env = data2;

18
deps/v8/tools/testrunner/local/progress.py

@ -291,6 +291,7 @@ class JsonTestProgressIndicator(ProgressIndicator):
self.arch = arch self.arch = arch
self.mode = mode self.mode = mode
self.results = [] self.results = []
self.tests = []
def Starting(self): def Starting(self):
self.progress_indicator.runner = self.runner self.progress_indicator.runner = self.runner
@ -304,10 +305,24 @@ class JsonTestProgressIndicator(ProgressIndicator):
# Buildbot might start out with an empty file. # Buildbot might start out with an empty file.
complete_results = json.loads(f.read() or "[]") complete_results = json.loads(f.read() or "[]")
# Sort tests by duration.
timed_tests = [t for t in self.tests if t.duration is not None]
timed_tests.sort(lambda a, b: cmp(b.duration, a.duration))
slowest_tests = [
{
"name": test.GetLabel(),
"flags": test.flags,
"command": EscapeCommand(self.runner.GetCommand(test)).replace(
ABS_PATH_PREFIX, ""),
"duration": test.duration,
} for test in timed_tests[:20]
]
complete_results.append({ complete_results.append({
"arch": self.arch, "arch": self.arch,
"mode": self.mode, "mode": self.mode,
"results": self.results, "results": self.results,
"slowest_tests": slowest_tests,
}) })
with open(self.json_test_results, "w") as f: with open(self.json_test_results, "w") as f:
@ -318,6 +333,8 @@ class JsonTestProgressIndicator(ProgressIndicator):
def HasRun(self, test, has_unexpected_output): def HasRun(self, test, has_unexpected_output):
self.progress_indicator.HasRun(test, has_unexpected_output) self.progress_indicator.HasRun(test, has_unexpected_output)
# Buffer all tests for sorting the durations in the end.
self.tests.append(test)
if not has_unexpected_output: if not has_unexpected_output:
# Omit tests that run as expected. Passing tests of reruns after failures # Omit tests that run as expected. Passing tests of reruns after failures
# will have unexpected_output to be reported here has well. # will have unexpected_output to be reported here has well.
@ -334,6 +351,7 @@ class JsonTestProgressIndicator(ProgressIndicator):
"exit_code": test.output.exit_code, "exit_code": test.output.exit_code,
"result": test.suite.GetOutcome(test), "result": test.suite.GetOutcome(test),
"expected": list(test.outcomes or ["PASS"]), "expected": list(test.outcomes or ["PASS"]),
"duration": test.duration,
}) })

Loading…
Cancel
Save