Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timob 13343 1 0 x #161

Merged
merged 2 commits into from
Apr 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
444 changes: 222 additions & 222 deletions lib/Base.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions lib/CodeProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,9 @@ function processQueuedFunctions() {
Runtime.log('debug', 'Evaluating queued function at ' + queuedFunction.filename + ':' + queuedFunction.line);
Runtime.recursionCount++;
try {
queuedFunction.func.call(queuedFunction.thisVal, queuedFunction.args, queuedFunction.ambiguousContext);
queuedFunction.func.callFunction(queuedFunction.thisVal, queuedFunction.args, {
isAmbiguousContext: queuedFunction.ambiguousContext
});
} catch (e) {
if (e.isCodeProcessorException) {
Runtime.reportError('uncaughtException', processException(Runtime._exception));
Expand Down Expand Up @@ -717,7 +719,10 @@ function processUnvisitedCode() {

Runtime.recursionCount++;
try {
funcObject.call(new Base.UnknownType(), args, true, true);
funcObject.callFunction(new Base.UnknownType(), args, {
isAmbiguousContext: true,
alwaysInvoke: true
});
} catch (e) {
if (e.isCodeProcessorException) {
Runtime.reportError('uncaughtException', processException(Runtime._exception));
Expand Down
6 changes: 3 additions & 3 deletions lib/base/constructors/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function ArrayIsArrayFunc(className) {
FunctionTypeBase.call(this, 1, className || 'Function');
}
util.inherits(ArrayIsArrayFunc, FunctionTypeBase);
ArrayIsArrayFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ArrayIsArrayFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var arg = args[0];
Expand Down Expand Up @@ -59,10 +59,10 @@ function ArrayConstructor(className) {
this.put('isArray', new ArrayIsArrayFunc(), false, true);
}
util.inherits(ArrayConstructor, FunctionTypeBase);
ArrayConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
ArrayConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {
return ArrayConstructor.prototype.construct.call(this, args);
});
ArrayConstructor.prototype.construct = wrapNativeCall(function call(args) {
ArrayConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var array,
Expand Down
4 changes: 2 additions & 2 deletions lib/base/constructors/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function BooleanConstructor(className) {
}, false, true);
}
util.inherits(BooleanConstructor, FunctionTypeBase);
BooleanConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
BooleanConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var value = args[0];
Expand All @@ -42,7 +42,7 @@ BooleanConstructor.prototype.call = wrapNativeCall(function call(thisVal, args)

return value ? toBoolean(value) : new BooleanType(false);
});
BooleanConstructor.prototype.construct = wrapNativeCall(function call(args) {
BooleanConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var value = args[0],
Expand Down
10 changes: 5 additions & 5 deletions lib/base/constructors/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function DateParseFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(DateParseFunc, FunctionTypeBase);
DateParseFunc.prototype.call = wrapNativeCall(function call() {
DateParseFunc.prototype.callFunction = wrapNativeCall(function callFunction() {
return new UnknownType();
});

Expand All @@ -42,7 +42,7 @@ function DateUTCFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(DateUTCFunc, FunctionTypeBase);
DateUTCFunc.prototype.call = wrapNativeCall(function call() {
DateUTCFunc.prototype.callFunction = wrapNativeCall(function callFunction() {
return new UnknownType();
});

Expand All @@ -56,7 +56,7 @@ function DateNowFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(DateNowFunc, FunctionTypeBase);
DateNowFunc.prototype.call = wrapNativeCall(function call() {
DateNowFunc.prototype.callFunction = wrapNativeCall(function callFunction() {
if (Runtime.options.exactMode) {
return new NumberType(Date.now());
} else {
Expand All @@ -82,14 +82,14 @@ function DateConstructor(className) {
this.put('now', new DateNowFunc(), false, true);
}
util.inherits(DateConstructor, FunctionTypeBase);
DateConstructor.prototype.call = wrapNativeCall(function call() {
DateConstructor.prototype.callFunction = wrapNativeCall(function callFunction() {
if (Runtime.options.exactMode) {
return new StringType(Date());
} else {
return new UnknownType();
}
});
DateConstructor.prototype.construct = wrapNativeCall(function call(args) {
DateConstructor.prototype.construct = wrapNativeCall(function construct(args) {
var dateObj,
internalDateObj,
convertedArgs,
Expand Down
4 changes: 2 additions & 2 deletions lib/base/constructors/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function ErrorConstructor(errorType, className) {
this._errorType = errorType;
}
util.inherits(ErrorConstructor, FunctionTypeBase);
ErrorConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
ErrorConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Validate the parameters
if (areAnyUnknown((args || []).concat(thisVal))) {
Expand All @@ -43,7 +43,7 @@ ErrorConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {

return ErrorConstructor.prototype.construct.call(this, args);
});
ErrorConstructor.prototype.construct = wrapNativeCall(function call(args) {
ErrorConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var errorType = this._errorType,
Expand Down
4 changes: 2 additions & 2 deletions lib/base/constructors/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ function FunctionConstructor(className) {
}, false, true);
}
util.inherits(FunctionConstructor, FunctionTypeBase);
FunctionConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
FunctionConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {
return FunctionConstructor.prototype.construct.call(this, args);
});
FunctionConstructor.prototype.construct = wrapNativeCall(function call(args) {
FunctionConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var argCount = args.length,
Expand Down
4 changes: 2 additions & 2 deletions lib/base/constructors/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function NumberConstructor(className) {
addReadOnlyProperty(this, 'POSITIVE_INFINITY', new NumberType(Number.POSITIVE_INFINITY), false, true);
}
util.inherits(NumberConstructor, FunctionTypeBase);
NumberConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
NumberConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var value = args[0];
Expand All @@ -50,7 +50,7 @@ NumberConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {

return value ? toNumber(value) : new NumberType(0);
});
NumberConstructor.prototype.construct = wrapNativeCall(function call(args) {
NumberConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var value = args[0],
Expand Down
54 changes: 27 additions & 27 deletions lib/base/constructors/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function ObjectGetPrototypeOfFunc(className) {
FunctionTypeBase.call(this, 1, className || 'Function');
}
util.inherits(ObjectGetPrototypeOfFunc, FunctionTypeBase);
ObjectGetPrototypeOfFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectGetPrototypeOfFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0];
Expand All @@ -57,13 +57,13 @@ ObjectGetPrototypeOfFunc.prototype.call = wrapNativeCall(function call(thisVal,
* getOwnPropertyDescriptor() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.3
*/
function ObjectGetOwnPropertyDescriptorFunc(className) {
FunctionTypeBase.call(this, 2, className || 'Function');
}
util.inherits(ObjectGetOwnPropertyDescriptorFunc, FunctionTypeBase);
ObjectGetOwnPropertyDescriptorFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectGetOwnPropertyDescriptorFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -92,13 +92,13 @@ ObjectGetOwnPropertyDescriptorFunc.prototype.call = wrapNativeCall(function call
* getOwnPropertyNames() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.4
*/
function ObjectGetOwnPropertyNamesFunc(className) {
FunctionTypeBase.call(this, 1, className || 'Function');
}
util.inherits(ObjectGetOwnPropertyNamesFunc, FunctionTypeBase);
ObjectGetOwnPropertyNamesFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectGetOwnPropertyNamesFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -138,13 +138,13 @@ ObjectGetOwnPropertyNamesFunc.prototype.call = wrapNativeCall(function call(this
* create() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.5
*/
function ObjectCreateFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectCreateFunc, FunctionTypeBase);
ObjectCreateFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectCreateFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -181,13 +181,13 @@ ObjectCreateFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
* defineProperties() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.6
*/
function ObjectDefinePropertyFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectDefinePropertyFunc, FunctionTypeBase);
ObjectDefinePropertyFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectDefinePropertyFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -224,13 +224,13 @@ ObjectDefinePropertyFunc.prototype.call = wrapNativeCall(function call(thisVal,
* defineProperties() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.7
*/
function ObjectDefinePropertiesFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectDefinePropertiesFunc, FunctionTypeBase);
ObjectDefinePropertiesFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectDefinePropertiesFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o,
Expand Down Expand Up @@ -271,13 +271,13 @@ ObjectDefinePropertiesFunc.prototype.call = wrapNativeCall(function call(thisVal
* seal() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.8
*/
function ObjectSealFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectSealFunc, FunctionTypeBase);
ObjectSealFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectSealFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -312,13 +312,13 @@ ObjectSealFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
* freeze() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.9
*/
function ObjectFreezeFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectFreezeFunc, FunctionTypeBase);
ObjectFreezeFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectFreezeFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -356,13 +356,13 @@ ObjectFreezeFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
* preventExtensions() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.10
*/
function ObjectPreventExtensionsFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectPreventExtensionsFunc, FunctionTypeBase);
ObjectPreventExtensionsFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectPreventExtensionsFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0];
Expand All @@ -389,13 +389,13 @@ ObjectPreventExtensionsFunc.prototype.call = wrapNativeCall(function call(thisVa
* isSealed() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.11
*/
function ObjectIsSealedFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectIsSealedFunc, FunctionTypeBase);
ObjectIsSealedFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectIsSealedFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0];
Expand Down Expand Up @@ -426,13 +426,13 @@ ObjectIsSealedFunc.prototype.call = wrapNativeCall(function call(thisVal, args)
* isFrozen() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.12
*/
function ObjectIsFrozenFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectIsFrozenFunc, FunctionTypeBase);
ObjectIsFrozenFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectIsFrozenFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -465,13 +465,13 @@ ObjectIsFrozenFunc.prototype.call = wrapNativeCall(function call(thisVal, args)
* isExtensible() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.13
*/
function ObjectIsExtensibleFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectIsExtensibleFunc, FunctionTypeBase);
ObjectIsExtensibleFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectIsExtensibleFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0];
Expand All @@ -495,13 +495,13 @@ ObjectIsExtensibleFunc.prototype.call = wrapNativeCall(function call(thisVal, ar
* keys() prototype method
*
* @private
* @see ECMA-262 Spec Chapter 15.2.3.2
* @see ECMA-262 Spec Chapter 15.2.3.14
*/
function ObjectKeysFunc(className) {
FunctionTypeBase.call(this, 0, className || 'Function');
}
util.inherits(ObjectKeysFunc, FunctionTypeBase);
ObjectKeysFunc.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectKeysFunc.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var o = args[0],
Expand Down Expand Up @@ -567,7 +567,7 @@ function ObjectConstructor(className) {
this.put('keys', new ObjectKeysFunc(), false, true);
}
util.inherits(ObjectConstructor, FunctionTypeBase);
ObjectConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
ObjectConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var value = args[0];
Expand All @@ -585,7 +585,7 @@ ObjectConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
// Step 2
return toObject(value);
});
ObjectConstructor.prototype.construct = wrapNativeCall(function call(args) {
ObjectConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var value = args[0];
Expand Down
4 changes: 2 additions & 2 deletions lib/base/constructors/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function RegExpConstructor(className) {
}, false, true);
}
util.inherits(RegExpConstructor, FunctionTypeBase);
RegExpConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {
RegExpConstructor.prototype.callFunction = wrapNativeCall(function callFunction(thisVal, args) {

// Variable declarations
var pattern = args[0];
Expand All @@ -48,7 +48,7 @@ RegExpConstructor.prototype.call = wrapNativeCall(function call(thisVal, args) {

return RegExpConstructor.prototype.construct(args);
});
RegExpConstructor.prototype.construct = wrapNativeCall(function call(args) {
RegExpConstructor.prototype.construct = wrapNativeCall(function construct(args) {

// Variable declarations
var pattern = args[0] || new StringType(''),
Expand Down