Commit 7d7292a6 authored by mlippautz's avatar mlippautz Committed by Commit bot

Revert of Initialize maths result array in JS. (patchset #1 id:1 of...

Revert of Initialize maths result array in JS. (patchset #1 id:1 of https://codereview.chromium.org/1421703004/ )

Reason for revert:
Failed on
  http://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20nosnap/builds/5020

Original issue's description:
> Initialize maths result array in JS.
>
> R=ishell@chromium.org
>
> Committed: https://crrev.com/aa26f5d4a11a1e5655d425ff40ced79c8ecdd55f
> Cr-Commit-Position: refs/heads/master@{#31722}

TBR=ishell@chromium.org,yangguo@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1409143011

Cr-Commit-Position: refs/heads/master@{#31723}
parent aa26f5d4
...@@ -197,6 +197,8 @@ class Genesis BASE_EMBEDDED { ...@@ -197,6 +197,8 @@ class Genesis BASE_EMBEDDED {
Handle<JSFunction> empty_function, Handle<JSFunction> empty_function,
ContextType context_type); ContextType context_type);
void InitializeExperimentalGlobal(); void InitializeExperimentalGlobal();
// Typed arrays are not serializable and have to initialized afterwards.
bool InitializeBuiltinTypedArrays();
// Depending on the situation, expose and/or get rid of the utils object. // Depending on the situation, expose and/or get rid of the utils object.
void ConfigureUtilsObject(ContextType context_type); void ConfigureUtilsObject(ContextType context_type);
...@@ -1787,6 +1789,26 @@ Handle<JSTypedArray> CreateTypedArray(Isolate* isolate, ExternalArrayType type, ...@@ -1787,6 +1789,26 @@ Handle<JSTypedArray> CreateTypedArray(Isolate* isolate, ExternalArrayType type,
} }
bool Genesis::InitializeBuiltinTypedArrays() {
HandleScope scope(isolate());
const size_t num_elements = 2;
double* data = NULL;
Handle<JSTypedArray> rempio2result =
CreateTypedArray(isolate(), kExternalFloat64Array, num_elements, &data);
for (size_t i = 0; i < num_elements; i++) data[i] = 0;
Handle<JSObject> utils =
Handle<JSObject>::cast(isolate()->natives_utils_object());
Handle<String> name_string = isolate()->factory()->NewStringFromAsciiChecked(
"InitializeBuiltinTypedArrays");
Handle<Object> fun = JSObject::GetDataProperty(utils, name_string);
Handle<Object> receiver = isolate()->factory()->undefined_value();
Handle<Object> args[] = {utils, rempio2result};
return !Execution::Call(isolate(), fun, receiver, arraysize(args), args)
.is_null();
}
void Genesis::ConfigureUtilsObject(ContextType context_type) { void Genesis::ConfigureUtilsObject(ContextType context_type) {
switch (context_type) { switch (context_type) {
// We still need the utils object to find debug functions. // We still need the utils object to find debug functions.
...@@ -3231,6 +3253,7 @@ Genesis::Genesis(Isolate* isolate, ...@@ -3231,6 +3253,7 @@ Genesis::Genesis(Isolate* isolate,
// snapshot as we should be able to turn them off at runtime. Re-installing // snapshot as we should be able to turn them off at runtime. Re-installing
// them after they have already been deserialized would also fail. // them after they have already been deserialized would also fail.
if (context_type == FULL_CONTEXT) { if (context_type == FULL_CONTEXT) {
if (!InitializeBuiltinTypedArrays()) return;
if (!isolate->serializer_enabled()) { if (!isolate->serializer_enabled()) {
InitializeExperimentalGlobal(); InitializeExperimentalGlobal();
if (!InstallExperimentalNatives()) return; if (!InstallExperimentalNatives()) return;
...@@ -3243,6 +3266,7 @@ Genesis::Genesis(Isolate* isolate, ...@@ -3243,6 +3266,7 @@ Genesis::Genesis(Isolate* isolate,
// for each new context. // for each new context.
} else if (context_type == DEBUG_CONTEXT) { } else if (context_type == DEBUG_CONTEXT) {
DCHECK(!isolate->serializer_enabled()); DCHECK(!isolate->serializer_enabled());
if (!InitializeBuiltinTypedArrays()) return;
InitializeExperimentalGlobal(); InitializeExperimentalGlobal();
if (!InstallDebuggerNatives()) return; if (!InstallDebuggerNatives()) return;
} }
......
...@@ -247,12 +247,12 @@ function PostExperimentals(utils) { ...@@ -247,12 +247,12 @@ function PostExperimentals(utils) {
utils.InitializeRNG(); utils.InitializeRNG();
utils.InitializeRNG = UNDEFINED; utils.InitializeRNG = UNDEFINED;
utils.CreateDoubleResultArray();
utils.CreateDoubleResultArray = UNDEFINED;
utils.Export = UNDEFINED; utils.Export = UNDEFINED;
utils.PostDebug = UNDEFINED; utils.PostDebug = UNDEFINED;
utils.PostExperimentals = UNDEFINED; utils.PostExperimentals = UNDEFINED;
utils.InitializeBuiltinTypedArrays = UNDEFINED;
utils.SetupTypedArray = UNDEFINED;
typed_array_setup = UNDEFINED; typed_array_setup = UNDEFINED;
} }
...@@ -264,8 +264,6 @@ function PostDebug(utils) { ...@@ -264,8 +264,6 @@ function PostDebug(utils) {
utils.InitializeRNG(); utils.InitializeRNG();
utils.InitializeRNG = UNDEFINED; utils.InitializeRNG = UNDEFINED;
utils.CreateDoubleResultArray();
utils.CreateDoubleResultArray = UNDEFINED;
exports_container = UNDEFINED; exports_container = UNDEFINED;
...@@ -274,6 +272,8 @@ function PostDebug(utils) { ...@@ -274,6 +272,8 @@ function PostDebug(utils) {
utils.ImportNow = UNDEFINED; utils.ImportNow = UNDEFINED;
utils.PostDebug = UNDEFINED; utils.PostDebug = UNDEFINED;
utils.PostExperimentals = UNDEFINED; utils.PostExperimentals = UNDEFINED;
utils.InitializeBuiltinTypedArrays = UNDEFINED;
utils.SetupTypedArray = UNDEFINED;
typed_array_setup = UNDEFINED; typed_array_setup = UNDEFINED;
} }
...@@ -304,6 +304,8 @@ utils.SetUpLockedPrototype = SetUpLockedPrototype; ...@@ -304,6 +304,8 @@ utils.SetUpLockedPrototype = SetUpLockedPrototype;
utils.PostNatives = PostNatives; utils.PostNatives = PostNatives;
utils.PostExperimentals = PostExperimentals; utils.PostExperimentals = PostExperimentals;
utils.PostDebug = PostDebug; utils.PostDebug = PostDebug;
utils.SetupTypedArray = SetupTypedArray;
utils.InitializeBuiltinTypedArrays = InitializeBuiltinTypedArrays;
%ToFastProperties(utils); %ToFastProperties(utils);
......
...@@ -68,8 +68,8 @@ RUNTIME_FUNCTION(Runtime_RemPiO2) { ...@@ -68,8 +68,8 @@ RUNTIME_FUNCTION(Runtime_RemPiO2) {
CONVERT_DOUBLE_ARG_CHECKED(x, 0); CONVERT_DOUBLE_ARG_CHECKED(x, 0);
CONVERT_ARG_CHECKED(JSTypedArray, result, 1); CONVERT_ARG_CHECKED(JSTypedArray, result, 1);
RUNTIME_ASSERT(result->byte_length() == Smi::FromInt(2 * sizeof(double))); RUNTIME_ASSERT(result->byte_length() == Smi::FromInt(2 * sizeof(double)));
FixedFloat64Array* array = FixedFloat64Array::cast(result->elements()); void* backing_store = JSArrayBuffer::cast(result->buffer())->backing_store();
double* y = static_cast<double*>(array->DataPtr()); double* y = static_cast<double*>(backing_store);
return Smi::FromInt(fdlibm::rempio2(x, y)); return Smi::FromInt(fdlibm::rempio2(x, y));
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Imports // Imports
var GlobalFloat64Array = global.Float64Array;
var GlobalMath = global.Math; var GlobalMath = global.Math;
var MathAbs; var MathAbs;
var MathExp; var MathExp;
...@@ -40,9 +39,9 @@ utils.Import(function(from) { ...@@ -40,9 +39,9 @@ utils.Import(function(from) {
MathExp = from.MathExp; MathExp = from.MathExp;
}); });
utils.CreateDoubleResultArray = function(global) { utils.SetupTypedArray(function(arg) {
rempio2result = new GlobalFloat64Array(2); rempio2result = arg;
}; });
// ------------------------------------------------------------------- // -------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment