diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2012-04-17 11:03:39 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-26 08:55:55 +0200 |
commit | 227e72d1bba70d518639996aab4146b060507cd6 (patch) | |
tree | 723564e760e94a7d205a3d3300c44192e1d2f2e1 /src/3rdparty/v8/src/d8.js | |
parent | 5b1fcb16da41f711f27f2e8ff84de8b70a30b645 (diff) | |
download | qtjsbackend-227e72d1bba70d518639996aab4146b060507cd6.tar.gz |
Updated V8 from git://github.com/v8/v8.git to 57f8959fb264354ba1a2e5118db512f588917061
Update V8 source to version 3.10.1.
* Added optimizations and stability improvements on all platforms.
* Various performance improvements.
* Cleanup ScopeInfo and SerializedScopeInfo.
* Introduce extended mode.
* Implemented performance improvements to the incremental garbage
collector.
* Fixed handling of arrays in DefineOwnProperty. (issue 1756)
* Fixed GCC 4.7 warnings.
* Performance improvements for large Smi-only arrays.
* Reduce the space used by the stack for the profiling thread.
* Reduced memory use immediately after starting V8.
* Fixed VFP detection through compiler defines. (issue 1996)
* Remove static initializers in v8. (issue 1859)
* Optimized boot-up memory use.
* Optimized regular expressions.
Change-Id: I2dad3092612de279179950dae4dd43daf0463a9f
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/d8.js')
-rw-r--r-- | src/3rdparty/v8/src/d8.js | 140 |
1 files changed, 73 insertions, 67 deletions
diff --git a/src/3rdparty/v8/src/d8.js b/src/3rdparty/v8/src/d8.js index 3009037..819135a 100644 --- a/src/3rdparty/v8/src/d8.js +++ b/src/3rdparty/v8/src/d8.js @@ -25,11 +25,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +"use strict"; + String.prototype.startsWith = function (str) { - if (str.length > this.length) + if (str.length > this.length) { return false; + } return this.substr(0, str.length) == str; -} +}; function log10(num) { return Math.log(num)/Math.log(10); @@ -52,8 +55,9 @@ function GetCompletions(global, last, full) { for (var i = 0; i < parts.length; i++) { var part = parts[i]; var next = current[part]; - if (!next) + if (!next) { return []; + } current = next; } var result = []; @@ -63,8 +67,9 @@ function GetCompletions(global, last, full) { var properties = mirror.properties(); for (var i = 0; i < properties.length; i++) { var name = properties[i].name(); - if (typeof name === 'string' && name.startsWith(last)) + if (typeof name === 'string' && name.startsWith(last)) { result.push(name); + } } current = ToInspectableObject(current.__proto__); } @@ -73,7 +78,7 @@ function GetCompletions(global, last, full) { // Global object holding debugger related constants and state. -const Debug = {}; +var Debug = {}; // Debug events which can occour in the V8 JavaScript engine. These originate @@ -108,22 +113,24 @@ Debug.ScopeType = { Global: 0, // Current debug state. -const kNoFrame = -1; +var kNoFrame = -1; Debug.State = { currentFrame: kNoFrame, displaySourceStartLine: -1, displaySourceEndLine: -1, currentSourceLine: -1 -} +}; var trace_compile = false; // Tracing all compile events? var trace_debug_json = false; // Tracing all debug json packets? -var last_cmd_line = ''; +var last_cmd = ''; //var lol_is_enabled; // Set to true in d8.cc if LIVE_OBJECT_LIST is defined. var lol_next_dump_index = 0; -const kDefaultLolLinesToPrintAtATime = 10; -const kMaxLolLinesToPrintAtATime = 1000; +var kDefaultLolLinesToPrintAtATime = 10; +var kMaxLolLinesToPrintAtATime = 1000; var repeat_cmd_line = ''; var is_running = true; +// Global variable used to store whether a handle was requested. +var lookup_handle = null; // Copied from debug-delay.js. This is needed below: function ScriptTypeFlag(type) { @@ -150,7 +157,7 @@ function DebugMessageDetails(message) { } function DebugEventDetails(response) { - details = {text:'', running:false} + var details = {text:'', running:false}; // Get the running state. details.running = response.running(); @@ -217,7 +224,7 @@ function DebugEventDetails(response) { case 'afterCompile': if (trace_compile) { - result = 'Source ' + body.script.name + ' compiled:\n' + result = 'Source ' + body.script.name + ' compiled:\n'; var source = body.script.source; if (!(source[source.length - 1] == '\n')) { result += source; @@ -237,7 +244,7 @@ function DebugEventDetails(response) { } return details; -}; +} function SourceInfo(body) { @@ -279,7 +286,7 @@ function SourceUnderline(source_text, position) { // Return the source line text with the underline beneath. return source_text + '\n' + underline; -}; +} // Converts a text command to a JSON request. @@ -289,7 +296,7 @@ function DebugCommandToJSONRequest(cmd_line) { print("sending: '" + result + "'"); } return result; -}; +} function DebugRequest(cmd_line) { @@ -514,7 +521,7 @@ function DebugRequest(cmd_line) { DebugRequest.prototype.JSONRequest = function() { return this.request_; -} +}; function RequestPacket(command) { @@ -536,14 +543,14 @@ RequestPacket.prototype.toJSONProtocol = function() { json += ',"arguments":'; // Encode the arguments part. if (this.arguments.toJSONProtocol) { - json += this.arguments.toJSONProtocol() + json += this.arguments.toJSONProtocol(); } else { json += SimpleObjectToJSON_(this.arguments); } } json += '}'; return json; -} +}; DebugRequest.prototype.createRequest = function(command) { @@ -583,7 +590,6 @@ DebugRequest.prototype.createLOLRequest = function(command, // Create a JSON request for the evaluation command. DebugRequest.prototype.makeEvaluateJSONRequest_ = function(expression) { - // Global varaible used to store whether a handle was requested. lookup_handle = null; if (lol_is_enabled) { @@ -1310,7 +1316,7 @@ DebugRequest.prototype.lolMakeListRequest = } return request; -} +}; function extractObjId(args) { @@ -1499,7 +1505,7 @@ DebugRequest.prototype.traceCommand_ = function(args) { } else { throw new Error('Invalid trace arguments.'); } -} +}; // Handle the help command. DebugRequest.prototype.helpCommand_ = function(args) { @@ -1608,7 +1614,7 @@ DebugRequest.prototype.helpCommand_ = function(args) { print(''); print('disconnect|exit|quit - disconnects and quits the debugger'); print('help - prints this help information'); -} +}; function formatHandleReference_(value) { @@ -1623,7 +1629,7 @@ function formatHandleReference_(value) { function formatObject_(value, include_properties) { var result = ''; result += formatHandleReference_(value); - result += ', type: object' + result += ', type: object'; result += ', constructor '; var ctor = value.constructorFunctionValue(); result += formatHandleReference_(ctor); @@ -1943,7 +1949,7 @@ function roundNumber(num, length) { // Convert a JSON response to text for display in a text based debugger. function DebugResponseDetails(response) { - details = {text:'', running:false} + var details = { text: '', running: false }; try { if (!response.success()) { @@ -2168,7 +2174,7 @@ function DebugResponseDetails(response) { } var current_line = from_line + num; - spacer = maxdigits - (1 + Math.floor(log10(current_line))); + var spacer = maxdigits - (1 + Math.floor(log10(current_line))); if (current_line == Debug.State.currentSourceLine + 1) { for (var i = 0; i < maxdigits; i++) { result += '>'; @@ -2308,7 +2314,7 @@ function DebugResponseDetails(response) { } return details; -}; +} /** @@ -2334,7 +2340,7 @@ function ProtocolPackage(json) { */ ProtocolPackage.prototype.type = function() { return this.packet_.type; -} +}; /** @@ -2343,7 +2349,7 @@ ProtocolPackage.prototype.type = function() { */ ProtocolPackage.prototype.event = function() { return this.packet_.event; -} +}; /** @@ -2352,7 +2358,7 @@ ProtocolPackage.prototype.event = function() { */ ProtocolPackage.prototype.requestSeq = function() { return this.packet_.request_seq; -} +}; /** @@ -2361,27 +2367,27 @@ ProtocolPackage.prototype.requestSeq = function() { */ ProtocolPackage.prototype.running = function() { return this.packet_.running ? true : false; -} +}; ProtocolPackage.prototype.success = function() { return this.packet_.success ? true : false; -} +}; ProtocolPackage.prototype.message = function() { return this.packet_.message; -} +}; ProtocolPackage.prototype.command = function() { return this.packet_.command; -} +}; ProtocolPackage.prototype.body = function() { return this.packet_.body; -} +}; ProtocolPackage.prototype.bodyValue = function(index) { @@ -2390,12 +2396,12 @@ ProtocolPackage.prototype.bodyValue = function(index) { } else { return new ProtocolValue(this.packet_.body, this); } -} +}; ProtocolPackage.prototype.body = function() { return this.packet_.body; -} +}; ProtocolPackage.prototype.lookup = function(handle) { @@ -2405,12 +2411,12 @@ ProtocolPackage.prototype.lookup = function(handle) { } else { return new ProtocolReference(handle); } -} +}; ProtocolPackage.prototype.raw_json = function() { return this.raw_json_; -} +}; function ProtocolValue(value, packet) { @@ -2425,7 +2431,7 @@ function ProtocolValue(value, packet) { */ ProtocolValue.prototype.type = function() { return this.value_.type; -} +}; /** @@ -2434,7 +2440,7 @@ ProtocolValue.prototype.type = function() { */ ProtocolValue.prototype.field = function(name) { return this.value_[name]; -} +}; /** @@ -2444,7 +2450,7 @@ ProtocolValue.prototype.field = function(name) { ProtocolValue.prototype.isPrimitive = function() { return this.isUndefined() || this.isNull() || this.isBoolean() || this.isNumber() || this.isString(); -} +}; /** @@ -2453,7 +2459,7 @@ ProtocolValue.prototype.isPrimitive = function() { */ ProtocolValue.prototype.handle = function() { return this.value_.handle; -} +}; /** @@ -2462,7 +2468,7 @@ ProtocolValue.prototype.handle = function() { */ ProtocolValue.prototype.isUndefined = function() { return this.value_.type == 'undefined'; -} +}; /** @@ -2471,7 +2477,7 @@ ProtocolValue.prototype.isUndefined = function() { */ ProtocolValue.prototype.isNull = function() { return this.value_.type == 'null'; -} +}; /** @@ -2480,7 +2486,7 @@ ProtocolValue.prototype.isNull = function() { */ ProtocolValue.prototype.isBoolean = function() { return this.value_.type == 'boolean'; -} +}; /** @@ -2489,7 +2495,7 @@ ProtocolValue.prototype.isBoolean = function() { */ ProtocolValue.prototype.isNumber = function() { return this.value_.type == 'number'; -} +}; /** @@ -2498,7 +2504,7 @@ ProtocolValue.prototype.isNumber = function() { */ ProtocolValue.prototype.isString = function() { return this.value_.type == 'string'; -} +}; /** @@ -2508,7 +2514,7 @@ ProtocolValue.prototype.isString = function() { ProtocolValue.prototype.isObject = function() { return this.value_.type == 'object' || this.value_.type == 'function' || this.value_.type == 'error' || this.value_.type == 'regexp'; -} +}; /** @@ -2518,7 +2524,7 @@ ProtocolValue.prototype.isObject = function() { ProtocolValue.prototype.constructorFunctionValue = function() { var ctor = this.value_.constructorFunction; return this.packet_.lookup(ctor.ref); -} +}; /** @@ -2528,7 +2534,7 @@ ProtocolValue.prototype.constructorFunctionValue = function() { ProtocolValue.prototype.protoObjectValue = function() { var proto = this.value_.protoObject; return this.packet_.lookup(proto.ref); -} +}; /** @@ -2537,7 +2543,7 @@ ProtocolValue.prototype.protoObjectValue = function() { */ ProtocolValue.prototype.propertyCount = function() { return this.value_.properties ? this.value_.properties.length : 0; -} +}; /** @@ -2547,7 +2553,7 @@ ProtocolValue.prototype.propertyCount = function() { ProtocolValue.prototype.propertyName = function(index) { var property = this.value_.properties[index]; return property.name; -} +}; /** @@ -2562,7 +2568,7 @@ ProtocolValue.prototype.propertyIndex = function(name) { } } return null; -} +}; /** @@ -2572,7 +2578,7 @@ ProtocolValue.prototype.propertyIndex = function(name) { ProtocolValue.prototype.propertyValue = function(index) { var property = this.value_.properties[index]; return this.packet_.lookup(property.ref); -} +}; /** @@ -2581,12 +2587,12 @@ ProtocolValue.prototype.propertyValue = function(index) { */ ProtocolValue.prototype.value = function() { return this.value_.value; -} +}; ProtocolValue.prototype.valueString = function() { return this.value_.text; -} +}; function ProtocolReference(handle) { @@ -2596,7 +2602,7 @@ function ProtocolReference(handle) { ProtocolReference.prototype.handle = function() { return this.handle_; -} +}; function MakeJSONPair_(name, value) { @@ -2626,7 +2632,7 @@ function NumberToJSON_(value) { // Mapping of some control characters to avoid the \uXXXX syntax for most // commonly used control cahracters. -const ctrlCharMap_ = { +var ctrlCharMap_ = { '\b': '\\b', '\t': '\\t', '\n': '\\n', @@ -2638,12 +2644,12 @@ const ctrlCharMap_ = { // Regular expression testing for ", \ and control characters (0x00 - 0x1F). -const ctrlCharTest_ = new RegExp('["\\\\\x00-\x1F]'); +var ctrlCharTest_ = new RegExp('["\\\\\x00-\x1F]'); // Regular expression matching ", \ and control characters (0x00 - 0x1F) // globally. -const ctrlCharMatch_ = new RegExp('["\\\\\x00-\x1F]', 'g'); +var ctrlCharMatch_ = new RegExp('["\\\\\x00-\x1F]', 'g'); /** @@ -2667,7 +2673,7 @@ function StringToJSON_(value) { // Convert control character to unicode escape sequence. return '\\u00' + '0' + // TODO %NumberToRadixString(Math.floor(mapped / 16), 16) + - '0' // TODO %NumberToRadixString(mapped % 16, 16); + '0'; // TODO %NumberToRadixString(mapped % 16, 16) }) + '"'; } @@ -2685,12 +2691,12 @@ function StringToJSON_(value) { * @return {string} JSON formatted Date value */ function DateToISO8601_(value) { - function f(n) { + var f = function(n) { return n < 10 ? '0' + n : n; - } - function g(n) { + }; + var g = function(n) { return n < 10 ? '00' + n : n < 100 ? '0' + n : n; - } + }; return builtins.GetUTCFullYearFrom(value) + '-' + f(builtins.GetUTCMonthFrom(value) + 1) + '-' + f(builtins.GetUTCDateFrom(value)) + 'T' + @@ -2738,7 +2744,7 @@ function SimpleObjectToJSON_(object) { if (property_value === null) { property_value_json = 'null'; } else if (typeof property_value.toJSONProtocol == 'function') { - property_value_json = property_value.toJSONProtocol(true) + property_value_json = property_value.toJSONProtocol(true); } else if (property_value.constructor.name == 'Array'){ property_value_json = SimpleArrayToJSON_(property_value); } else { @@ -2789,7 +2795,7 @@ function SimpleArrayToJSON_(array) { } var elem = array[i]; if (elem.toJSONProtocol) { - json += elem.toJSONProtocol(true) + json += elem.toJSONProtocol(true); } else if (typeof(elem) === 'object') { json += SimpleObjectToJSON_(elem); } else if (typeof(elem) === 'boolean') { |