Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2522)

Unified Diff: src/mirror-delay.js

Issue 18445: Changes to the mirror handling... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | test/mjsunit/mirror-object.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mirror-delay.js
===================================================================
--- src/mirror-delay.js (revision 1106)
+++ src/mirror-delay.js (working copy)
@@ -58,6 +58,11 @@
if (mirror.value() === value) {
return mirror;
}
+ // Special check for NaN as NaN == NaN is false.
+ if (mirror.isNumber() && isNaN(mirror.value()) &&
+ typeof value == 'number' && isNaN(value)) {
+ return mirror;
+ }
}
if (IS_UNDEFINED(value)) {
@@ -342,6 +347,14 @@
}
+/**
+ * Allocate a handle id for this object.
+ */
+Mirror.prototype.allocateHandle_ = function() {
+ this.handle_ = next_handle_++;
+}
+
+
Mirror.prototype.toText = function() {
// Simpel to text which is used when on specialization in subclass.
return "#<" + builtins.GetInstanceName(this.constructor.name) + ">";
@@ -357,8 +370,8 @@
*/
function ValueMirror(type, value) {
Mirror.call(this, type);
- this.handle_ = next_handle_++;
this.value_ = value;
+ this.allocateHandle_();
}
inherits(ValueMirror, Mirror);
@@ -1516,6 +1529,7 @@
function ScriptMirror(script) {
Mirror.call(this, SCRIPT_TYPE);
this.script_ = script;
+ this.allocateHandle_();
}
inherits(ScriptMirror, Mirror);
@@ -1656,9 +1670,10 @@
JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
details) {
- // If serializing a reference to a value just return the reference and add the
- // mirror to the referenced mirrors.
- if (reference && mirror.isValue()) {
+ // If serializing a reference to a mirror just return the reference and add
+ // the mirror to the referenced mirrors.
+ if (reference &&
+ (mirror.isValue() || mirror.isScript())) {
this.add_(mirror);
return '{"ref":' + mirror.handle() + '}';
}
@@ -1785,7 +1800,7 @@
content.push(MakeJSONPair_('source', StringToJSON_(mirror.source())));
}
if (mirror.script()) {
- content.push(MakeJSONPair_('script', this.serializeValue(mirror.script())));
+ content.push(MakeJSONPair_('script', this.serializeReference(mirror.script())));
}
}
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | test/mjsunit/mirror-object.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698