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

Side by Side Diff: test/mjsunit/mirror-unresolved-function.js

Issue 18092: Added handles to the mirror objects. When a mirror for an object is created... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/mirror-undefined.js ('k') | test/mjsunit/regress/regress-1081309.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Flags: --expose-debug-as debug 28 // Flags: --expose-debug-as debug
29 // Test the mirror object for unresolved functions. 29 // Test the mirror object for unresolved functions.
30 30
31 function MirrorRefCache(json_refs) {
32 var tmp = eval('(' + json_refs + ')');
33 this.refs_ = [];
34 for (var i = 0; i < tmp.length; i++) {
35 this.refs_[tmp[i].handle] = tmp[i];
36 }
37 }
38
39 MirrorRefCache.prototype.lookup = function(handle) {
40 return this.refs_[handle];
41 }
42
31 var mirror = new debug.UnresolvedFunctionMirror("f"); 43 var mirror = new debug.UnresolvedFunctionMirror("f");
32 var json = mirror.toJSONProtocol(true); 44 var serializer = debug.MakeMirrorSerializer();
45 var json = serializer.serializeValue(mirror);
46 var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
33 47
34 // Check the mirror hierachy for unresolved functions. 48 // Check the mirror hierachy for unresolved functions.
35 assertTrue(mirror instanceof debug.Mirror); 49 assertTrue(mirror instanceof debug.Mirror);
36 assertTrue(mirror instanceof debug.ValueMirror); 50 assertTrue(mirror instanceof debug.ValueMirror);
37 assertTrue(mirror instanceof debug.ObjectMirror); 51 assertTrue(mirror instanceof debug.ObjectMirror);
38 assertTrue(mirror instanceof debug.FunctionMirror); 52 assertTrue(mirror instanceof debug.FunctionMirror);
39 53
40 // Check the mirror properties for unresolved functions. 54 // Check the mirror properties for unresolved functions.
41 assertTrue(mirror.isUnresolvedFunction()); 55 assertTrue(mirror.isUnresolvedFunction());
42 assertEquals('function', mirror.type()); 56 assertEquals('function', mirror.type());
43 assertFalse(mirror.isPrimitive()); 57 assertFalse(mirror.isPrimitive());
44 assertEquals("Function", mirror.className()); 58 assertEquals("Function", mirror.className());
45 assertEquals("f", mirror.name()); 59 assertEquals("f", mirror.name());
46 assertFalse(mirror.resolved()); 60 assertFalse(mirror.resolved());
47 assertEquals(void 0, mirror.source()); 61 assertEquals(void 0, mirror.source());
48 assertEquals('undefined', mirror.constructorFunction().type()); 62 assertEquals('undefined', mirror.constructorFunction().type());
49 assertEquals('undefined', mirror.protoObject().type()); 63 assertEquals('undefined', mirror.protoObject().type());
50 assertEquals('undefined', mirror.prototypeObject().type()); 64 assertEquals('undefined', mirror.prototypeObject().type());
51 65
52 // Parse JSON representation of unresolved functions and check. 66 // Parse JSON representation of unresolved functions and check.
53 /*var fromJSON = eval('(' + json + ')'); 67 var fromJSON = eval('(' + json + ')');
54 assertEquals('function', fromJSON.type); 68 assertEquals('function', fromJSON.type, 'Unexpected mirror type in JSON');
55 assertEquals('Function', fromJSON.className); 69 assertEquals('Function', fromJSON.className, 'Unexpected mirror class name in JS ON');
56 assertEquals('undefined', fromJSON.constructorFunction.type); 70 assertEquals(mirror.constructorFunction().handle(), fromJSON.constructorFunction .ref, 'Unexpected constructor function handle in JSON');
57 assertEquals('undefined', fromJSON.protoObject.type); 71 assertEquals('undefined', refs.lookup(fromJSON.constructorFunction.ref).type, 'U nexpected constructor function type in JSON');
58 assertEquals('undefined', fromJSON.prototypeObject.type); 72 assertEquals(mirror.protoObject().handle(), fromJSON.protoObject.ref, 'Unexpecte d proto object handle in JSON');
73 assertEquals('undefined', refs.lookup(fromJSON.protoObject.ref).type, 'Unexpecte d proto object type in JSON');
74 assertEquals(mirror.prototypeObject().handle(), fromJSON.prototypeObject.ref, 'U nexpected prototype object handle in JSON');
75 assertEquals('undefined', refs.lookup(fromJSON.prototypeObject.ref).type, 'Unexp ected prototype object type in JSON');
59 assertFalse(fromJSON.resolved); 76 assertFalse(fromJSON.resolved);
60 assertEquals("f", fromJSON.name); 77 assertEquals("f", fromJSON.name);
61 assertEquals(void 0, fromJSON.source);*/ 78 assertEquals(void 0, fromJSON.source);
OLDNEW
« no previous file with comments | « test/mjsunit/mirror-undefined.js ('k') | test/mjsunit/regress/regress-1081309.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698