Revision: 20177
Author: yang...@chromium.org
Date: Mon Mar 24 08:22:24 2014 UTC
Log: Refactor inlined typed array runtime functions.
R=dslo...@chromium.org
Review URL: https://codereview.chromium.org/203443002
http://code.google.com/p/v8/source/detail?r=20177
Modified:
/branches/bleeding_edge/src/full-codegen.cc
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/src/typedarray.js
/branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js
/branches/bleeding_edge/test/mjsunit/fuzz-natives-part2.js
/branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js
/branches/bleeding_edge/test/mjsunit/fuzz-natives-part4.js
=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Mon Mar 17 08:31:21 2014 UTC
+++ /branches/bleeding_edge/src/full-codegen.cc Mon Mar 24 08:22:24 2014 UTC
@@ -978,6 +978,31 @@
masm()->CallRuntime(Runtime::kConstructDouble, 2);
context()->Plug(result_register());
}
+
+
+void FullCodeGenerator::EmitTypedArrayInitialize(CallRuntime* expr) {
+ ZoneList<Expression*>* args = expr->arguments();
+ ASSERT(args->length() == 5);
+ for (int i = 0; i < 5; i++) VisitForStackValue(args->at(i));
+ masm()->CallRuntime(Runtime::kTypedArrayInitialize, 5);
+ context()->Plug(result_register());
+}
+
+
+void FullCodeGenerator::EmitDataViewInitialize(CallRuntime* expr) {
+ ZoneList<Expression*>* args = expr->arguments();
+ ASSERT(args->length() == 4);
+ for (int i = 0; i < 4; i++) VisitForStackValue(args->at(i));
+ masm()->CallRuntime(Runtime::kDataViewInitialize, 4);
+ context()->Plug(result_register());
+}
+
+
+void FullCodeGenerator::EmitMaxSmi(CallRuntime* expr) {
+ ASSERT(expr->arguments()->length() == 0);
+ masm()->CallRuntime(Runtime::kMaxSmi, 0);
+ context()->Plug(result_register());
+}
void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Fri Mar 21 12:14:44 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Mon Mar 24 08:22:24 2014 UTC
@@ -8439,7 +8439,7 @@
}
-void HOptimizedGraphBuilder::VisitDataViewInitialize(
+void HOptimizedGraphBuilder::GenerateDataViewInitialize(
CallRuntime* expr) {
ZoneList<Expression*>* arguments = expr->arguments();
@@ -8462,7 +8462,7 @@
}
-void HOptimizedGraphBuilder::VisitTypedArrayInitialize(
+void HOptimizedGraphBuilder::GenerateTypedArrayInitialize(
CallRuntime* expr) {
ZoneList<Expression*>* arguments = expr->arguments();
@@ -8579,6 +8579,13 @@
}
byte_offset_smi.End();
}
+
+
+void HOptimizedGraphBuilder::GenerateMaxSmi(CallRuntime* expr) {
+ ASSERT(expr->arguments()->length() == 0);
+ HConstant* max_smi =
New<HConstant>(static_cast<int32_t>(Smi::kMaxValue));
+ return ast_context()->ReturnInstruction(max_smi, expr->id());
+}
void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
@@ -8592,20 +8599,6 @@
const Runtime::Function* function = expr->function();
ASSERT(function != NULL);
- if (function->function_id == Runtime::kDataViewInitialize) {
- return VisitDataViewInitialize(expr);
- }
-
- if (function->function_id == Runtime::kTypedArrayInitialize) {
- return VisitTypedArrayInitialize(expr);
- }
-
- if (function->function_id == Runtime::kMaxSmi) {
- ASSERT(expr->arguments()->length() == 0);
- HConstant* max_smi =
New<HConstant>(static_cast<int32_t>(Smi::kMaxValue));
- return ast_context()->ReturnInstruction(max_smi, expr->id());
- }
-
if (function->intrinsic_type == Runtime::INLINE) {
ASSERT(expr->name()->length() > 0);
ASSERT(expr->name()->Get(0) == '_');
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Wed Mar 19 13:39:09 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.h Mon Mar 24 08:22:24 2014 UTC
@@ -2321,13 +2321,9 @@
SmallMapList* types,
Handle<String> name);
- void VisitTypedArrayInitialize(CallRuntime* expr);
-
bool IsCallNewArrayInlineable(CallNew* expr);
void BuildInlinedCallNewArray(CallNew* expr);
- void VisitDataViewInitialize(CallRuntime* expr);
-
class PropertyAccessInfo {
public:
PropertyAccessInfo(HOptimizedGraphBuilder* builder,
=======================================
--- /branches/bleeding_edge/src/runtime.h Fri Mar 21 12:30:58 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h Mon Mar 24 08:22:24 2014 UTC
@@ -111,7 +111,6 @@
F(FlattenString, 1, 1) \
F(TryMigrateInstance, 1, 1) \
F(NotifyContextDisposed, 0, 1) \
- F(MaxSmi, 0, 1) \
\
/* Array join support */ \
F(PushIfAbsent, 2, 1) \
@@ -368,7 +367,6 @@
F(ArrayBufferIsView, 1, 1) \
F(ArrayBufferNeuter, 1, 1) \
\
- F(TypedArrayInitialize, 5, 1) \
F(TypedArrayInitializeFromArrayLike, 4, 1) \
F(TypedArrayGetBuffer, 1, 1) \
F(TypedArrayGetByteLength, 1, 1) \
@@ -376,7 +374,6 @@
F(TypedArrayGetLength, 1, 1) \
F(TypedArraySetFastCases, 3, 1) \
\
- F(DataViewInitialize, 4, 1) \
F(DataViewGetBuffer, 1, 1) \
F(DataViewGetByteLength, 1, 1) \
F(DataViewGetByteOffset, 1, 1) \
@@ -662,7 +659,10 @@
F(NumberToString, 1,
1) \
F(DoubleHi, 1,
1) \
F(DoubleLo, 1,
1) \
- F(ConstructDouble, 2, 1)
+ F(ConstructDouble, 2,
1) \
+ F(TypedArrayInitialize, 5,
1) \
+ F(DataViewInitialize, 4,
1) \
+ F(MaxSmi, 0, 1)
//---------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/typedarray.js Tue Mar 18 10:55:29 2014 UTC
+++ /branches/bleeding_edge/src/typedarray.js Mon Mar 24 08:22:24 2014 UTC
@@ -87,28 +87,28 @@
newByteLength = newLength * ELEMENT_SIZE;
}
if ((offset + newByteLength > bufferByteLength)
- || (newLength > %MaxSmi())) {
+ || (newLength > %_MaxSmi())) {
throw MakeRangeError("invalid_typed_array_length");
}
- %TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
+ %_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
}
function NAMEConstructByLength(obj, length) {
var l = IS_UNDEFINED(length) ?
0 : ToPositiveInteger(length, "invalid_typed_array_length");
- if (l > %MaxSmi()) {
+ if (l > %_MaxSmi()) {
throw MakeRangeError("invalid_typed_array_length");
}
var byteLength = l * ELEMENT_SIZE;
var buffer = new $ArrayBuffer(byteLength);
- %TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
+ %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
}
function NAMEConstructByArrayLike(obj, arrayLike) {
var length = arrayLike.length;
var l = ToPositiveInteger(length, "invalid_typed_array_length");
- if (l > %MaxSmi()) {
+ if (l > %_MaxSmi()) {
throw MakeRangeError("invalid_typed_array_length");
}
if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
@@ -350,7 +350,7 @@
if (length < 0 || offset + length > bufferByteLength) {
throw new MakeRangeError('invalid_data_view_length');
}
- %DataViewInitialize(this, buffer, offset, length);
+ %_DataViewInitialize(this, buffer, offset, length);
} else {
throw MakeTypeError('constructor_not_function', ["DataView"]);
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js Thu Jan 23
16:33:35 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js Mon Mar 24
08:22:24 2014 UTC
@@ -206,17 +206,14 @@
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize": true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part2.js Thu Jan 23
16:33:35 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part2.js Mon Mar 24
08:22:24 2014 UTC
@@ -207,17 +207,14 @@
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize": true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js Thu Feb 27
16:49:55 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part3.js Mon Mar 24
08:22:24 2014 UTC
@@ -206,17 +206,14 @@
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize":true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true,
+ "_DataViewInitialize":true,
};
var currentlyUncallable = {
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part4.js Thu Jan 23
16:33:35 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part4.js Mon Mar 24
08:22:24 2014 UTC
@@ -206,17 +206,14 @@
"_TwoByteSeqStringSetChar": true,
// Only applicable to TypedArrays.
- "TypedArrayInitialize": true,
+ "_TypedArrayInitialize": true,
// Only applicable to generators.
"_GeneratorNext": true,
"_GeneratorThrow": true,
// Only applicable to DataViews.
- "DataViewInitialize": true,
- "DataViewGetBuffer": true,
- "DataViewGetByteLength": true,
- "DataViewGetByteOffset": true
+ "_DataViewInitialize": true,
};
var currentlyUncallable = {
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.