Fix builtin/runtime name clashes generated by macros

Specifically: DataView{S,G}et* and a few more Math functions.

Also change indentation in typedarray.js for easier future builtins parsing.

R=dslomov@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21332 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 773a7eda
......@@ -11118,7 +11118,7 @@ void HOptimizedGraphBuilder::GenerateMathPow(CallRuntime* call) {
}
void HOptimizedGraphBuilder::GenerateMathLog(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateMathLogRT(CallRuntime* call) {
ASSERT(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop();
......
......@@ -30,17 +30,17 @@ function MathAbs(x) {
}
// ECMA 262 - 15.8.2.2
function MathAcos(x) {
function MathAcosJS(x) {
return %MathAcos(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.3
function MathAsin(x) {
function MathAsinJS(x) {
return %MathAsin(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.4
function MathAtan(x) {
function MathAtanJS(x) {
return %MathAtan(TO_NUMBER_INLINE(x));
}
......@@ -85,7 +85,7 @@ function MathFloor(x) {
// ECMA 262 - 15.8.2.10
function MathLog(x) {
return %_MathLog(TO_NUMBER_INLINE(x));
return %_MathLogRT(TO_NUMBER_INLINE(x));
}
// ECMA 262 - 15.8.2.11
......@@ -284,9 +284,9 @@ function SetUpMath() {
InstallFunctions($Math, DONT_ENUM, $Array(
"random", MathRandom,
"abs", MathAbs,
"acos", MathAcos,
"asin", MathAsin,
"atan", MathAtan,
"acos", MathAcosJS,
"asin", MathAsinJS,
"atan", MathAtanJS,
"ceil", MathCeil,
"cos", MathCos,
"exp", MathExp,
......
......@@ -7791,7 +7791,7 @@ RUNTIME_FUNCTION(Runtime_Math##Name) { \
RUNTIME_UNARY_MATH(Acos, acos)
RUNTIME_UNARY_MATH(Asin, asin)
RUNTIME_UNARY_MATH(Atan, atan)
RUNTIME_UNARY_MATH(Log, log)
RUNTIME_UNARY_MATH(LogRT, log)
#undef RUNTIME_UNARY_MATH
......
......@@ -685,7 +685,7 @@ namespace internal {
F(DoubleHi, 1, 1) \
F(DoubleLo, 1, 1) \
F(MathSqrtRT, 1, 1) \
F(MathLog, 1, 1) \
F(MathLogRT, 1, 1) \
/* Debugger */ \
F(DebugCallbackSupportsStepping, 1, 1)
......
......@@ -25,7 +25,7 @@ FUNCTION(9, Uint8ClampedArray, 1)
endmacro
macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) {
function NAMEConstructByArrayBuffer(obj, buffer, byteOffset, length) {
if (!IS_UNDEFINED(byteOffset)) {
byteOffset =
ToPositiveInteger(byteOffset, "invalid_typed_array_length");
......@@ -68,9 +68,9 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
throw MakeRangeError("invalid_typed_array_length");
}
%_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
}
}
function NAMEConstructByLength(obj, length) {
function NAMEConstructByLength(obj, length) {
var l = IS_UNDEFINED(length) ?
0 : ToPositiveInteger(length, "invalid_typed_array_length");
if (l > %_MaxSmi()) {
......@@ -83,9 +83,9 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
} else {
%_TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
}
}
}
function NAMEConstructByArrayLike(obj, arrayLike) {
function NAMEConstructByArrayLike(obj, arrayLike) {
var length = arrayLike.length;
var l = ToPositiveInteger(length, "invalid_typed_array_length");
......@@ -99,9 +99,9 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
obj[i] = arrayLike[i];
}
}
}
}
function NAMEConstructor(arg1, arg2, arg3) {
function NAMEConstructor(arg1, arg2, arg3) {
if (%_IsConstructCall()) {
if (IS_ARRAYBUFFER(arg1)) {
NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
......@@ -114,43 +114,43 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
} else {
throw MakeTypeError("constructor_not_function", ["NAME"])
}
}
}
function NAME_GetBuffer() {
function NAME_GetBuffer() {
if (!(%_ClassOf(this) === 'NAME')) {
throw MakeTypeError('incompatible_method_receiver',
["NAME.buffer", this]);
}
return %TypedArrayGetBuffer(this);
}
}
function NAME_GetByteLength() {
function NAME_GetByteLength() {
if (!(%_ClassOf(this) === 'NAME')) {
throw MakeTypeError('incompatible_method_receiver',
["NAME.byteLength", this]);
}
return %_ArrayBufferViewGetByteLength(this);
}
}
function NAME_GetByteOffset() {
function NAME_GetByteOffset() {
if (!(%_ClassOf(this) === 'NAME')) {
throw MakeTypeError('incompatible_method_receiver',
["NAME.byteOffset", this]);
}
return %_ArrayBufferViewGetByteOffset(this);
}
}
function NAME_GetLength() {
function NAME_GetLength() {
if (!(%_ClassOf(this) === 'NAME')) {
throw MakeTypeError('incompatible_method_receiver',
["NAME.length", this]);
}
return %_TypedArrayGetLength(this);
}
}
var $NAME = global.NAME;
var $NAME = global.NAME;
function NAMESubArray(begin, end) {
function NAMESubArray(begin, end) {
if (!(%_ClassOf(this) === 'NAME')) {
throw MakeTypeError('incompatible_method_receiver',
["NAME.subarray", this]);
......@@ -181,7 +181,7 @@ macro TYPED_ARRAY_CONSTRUCTOR(ARRAY_ID, NAME, ELEMENT_SIZE)
%_ArrayBufferViewGetByteOffset(this) + beginInt * ELEMENT_SIZE;
return new $NAME(%TypedArrayGetBuffer(this),
beginByteOffset, newLength);
}
}
endmacro
TYPED_ARRAYS(TYPED_ARRAY_CONSTRUCTOR)
......@@ -357,7 +357,7 @@ function DataViewConstructor(buffer, byteOffset, byteLength) { // length = 3
}
}
function DataViewGetBuffer() {
function DataViewGetBufferJS() {
if (!IS_DATAVIEW(this)) {
throw MakeTypeError('incompatible_method_receiver',
['DataView.buffer', this]);
......@@ -398,7 +398,7 @@ function ToPositiveDataViewOffset(offset) {
macro DATA_VIEW_GETTER_SETTER(TYPENAME)
function DataViewGetTYPENAME(offset, little_endian) {
function DataViewGetTYPENAMEJS(offset, little_endian) {
if (!IS_DATAVIEW(this)) {
throw MakeTypeError('incompatible_method_receiver',
['DataView.getTYPENAME', this]);
......@@ -411,7 +411,7 @@ function DataViewGetTYPENAME(offset, little_endian) {
!!little_endian);
}
function DataViewSetTYPENAME(offset, value, little_endian) {
function DataViewSetTYPENAMEJS(offset, value, little_endian) {
if (!IS_DATAVIEW(this)) {
throw MakeTypeError('incompatible_method_receiver',
['DataView.setTYPENAME', this]);
......@@ -438,34 +438,34 @@ function SetupDataView() {
// Set up constructor property on the DataView prototype.
%SetProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM);
InstallGetter($DataView.prototype, "buffer", DataViewGetBuffer);
InstallGetter($DataView.prototype, "buffer", DataViewGetBufferJS);
InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset);
InstallGetter($DataView.prototype, "byteLength", DataViewGetByteLength);
InstallFunctions($DataView.prototype, DONT_ENUM, $Array(
"getInt8", DataViewGetInt8,
"setInt8", DataViewSetInt8,
"getInt8", DataViewGetInt8JS,
"setInt8", DataViewSetInt8JS,
"getUint8", DataViewGetUint8,
"setUint8", DataViewSetUint8,
"getUint8", DataViewGetUint8JS,
"setUint8", DataViewSetUint8JS,
"getInt16", DataViewGetInt16,
"setInt16", DataViewSetInt16,
"getInt16", DataViewGetInt16JS,
"setInt16", DataViewSetInt16JS,
"getUint16", DataViewGetUint16,
"setUint16", DataViewSetUint16,
"getUint16", DataViewGetUint16JS,
"setUint16", DataViewSetUint16JS,
"getInt32", DataViewGetInt32,
"setInt32", DataViewSetInt32,
"getInt32", DataViewGetInt32JS,
"setInt32", DataViewSetInt32JS,
"getUint32", DataViewGetUint32,
"setUint32", DataViewSetUint32,
"getUint32", DataViewGetUint32JS,
"setUint32", DataViewSetUint32JS,
"getFloat32", DataViewGetFloat32,
"setFloat32", DataViewSetFloat32,
"getFloat32", DataViewGetFloat32JS,
"setFloat32", DataViewSetFloat32JS,
"getFloat64", DataViewGetFloat64,
"setFloat64", DataViewSetFloat64
"getFloat64", DataViewGetFloat64JS,
"setFloat64", DataViewSetFloat64JS
));
}
......
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