OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 "both_mirror = debug.MakeMirror(intercepted_both)"); | 2653 "both_mirror = debug.MakeMirror(intercepted_both)"); |
2654 CHECK(CompileRun( | 2654 CHECK(CompileRun( |
2655 "named_mirror instanceof debug.ObjectMirror")->BooleanValue()); | 2655 "named_mirror instanceof debug.ObjectMirror")->BooleanValue()); |
2656 CHECK(CompileRun( | 2656 CHECK(CompileRun( |
2657 "indexed_mirror instanceof debug.ObjectMirror")->BooleanValue()); | 2657 "indexed_mirror instanceof debug.ObjectMirror")->BooleanValue()); |
2658 CHECK(CompileRun( | 2658 CHECK(CompileRun( |
2659 "both_mirror instanceof debug.ObjectMirror")->BooleanValue()); | 2659 "both_mirror instanceof debug.ObjectMirror")->BooleanValue()); |
2660 | 2660 |
2661 // Get the property names from the interceptors | 2661 // Get the property names from the interceptors |
2662 CompileRun( | 2662 CompileRun( |
2663 "named_names = named_mirror.interceptorPropertyNames();" | 2663 "named_names = named_mirror.propertyNames();" |
2664 "indexed_names = indexed_mirror.interceptorPropertyNames();" | 2664 "indexed_names = indexed_mirror.propertyNames();" |
2665 "both_names = both_mirror.interceptorPropertyNames()"); | 2665 "both_names = both_mirror.propertyNames()"); |
2666 CHECK_EQ(3, CompileRun("named_names.length")->Int32Value()); | 2666 CHECK_EQ(3, CompileRun("named_names.length")->Int32Value()); |
2667 CHECK_EQ(2, CompileRun("indexed_names.length")->Int32Value()); | 2667 CHECK_EQ(2, CompileRun("indexed_names.length")->Int32Value()); |
2668 CHECK_EQ(5, CompileRun("both_names.length")->Int32Value()); | 2668 CHECK_EQ(5, CompileRun("both_names.length")->Int32Value()); |
2669 | 2669 |
2670 // Check the expected number of properties. | 2670 // Check the expected number of properties. |
2671 const char* source; | 2671 const char* source; |
2672 source = "named_mirror.interceptorProperties().length"; | 2672 source = "named_mirror.properties().length"; |
2673 CHECK_EQ(3, CompileRun(source)->Int32Value()); | 2673 CHECK_EQ(3, CompileRun(source)->Int32Value()); |
2674 | 2674 |
2675 source = "indexed_mirror.interceptorProperties().length"; | 2675 source = "indexed_mirror.properties().length"; |
2676 CHECK_EQ(2, CompileRun(source)->Int32Value()); | 2676 CHECK_EQ(2, CompileRun(source)->Int32Value()); |
2677 | 2677 |
2678 source = "both_mirror.interceptorProperties().length"; | 2678 source = "both_mirror.properties().length"; |
2679 CHECK_EQ(5, CompileRun(source)->Int32Value()); | 2679 CHECK_EQ(5, CompileRun(source)->Int32Value()); |
2680 | 2680 |
2681 source = "both_mirror.interceptorProperties(1).length"; | 2681 // 1 is PropertyKind.Named; |
| 2682 source = "both_mirror.properties(1).length"; |
2682 CHECK_EQ(3, CompileRun(source)->Int32Value()); | 2683 CHECK_EQ(3, CompileRun(source)->Int32Value()); |
2683 | 2684 |
2684 source = "both_mirror.interceptorProperties(2).length"; | 2685 // 2 is PropertyKind.Indexed; |
| 2686 source = "both_mirror.properties(2).length"; |
2685 CHECK_EQ(2, CompileRun(source)->Int32Value()); | 2687 CHECK_EQ(2, CompileRun(source)->Int32Value()); |
2686 | 2688 |
2687 source = "both_mirror.interceptorProperties(3).length"; | 2689 // 3 is PropertyKind.Named | PropertyKind.Indexed; |
| 2690 source = "both_mirror.properties(3).length"; |
2688 CHECK_EQ(5, CompileRun(source)->Int32Value()); | 2691 CHECK_EQ(5, CompileRun(source)->Int32Value()); |
2689 | 2692 |
| 2693 // Get the interceptor properties for the object with only named interceptor. |
| 2694 CompileRun("named_values = named_mirror.properties()"); |
| 2695 |
| 2696 // Check that the properties are interceptor properties. |
| 2697 for (int i = 0; i < 3; i++) { |
| 2698 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
| 2699 OS::SNPrintF(buffer, |
| 2700 "named_values[%d] instanceof debug.PropertyMirror", i); |
| 2701 CHECK(CompileRun(buffer.start())->BooleanValue()); |
| 2702 |
| 2703 // 4 is PropertyType.Interceptor |
| 2704 OS::SNPrintF(buffer, "named_values[%d].propertyType()", i); |
| 2705 CHECK_EQ(4, CompileRun(buffer.start())->Int32Value()); |
| 2706 |
| 2707 OS::SNPrintF(buffer, "named_values[%d].isNative()", i); |
| 2708 CHECK(CompileRun(buffer.start())->BooleanValue()); |
| 2709 } |
| 2710 |
| 2711 // Get the interceptor properties for the object with only indexed |
| 2712 // interceptor. |
| 2713 CompileRun("indexed_values = indexed_mirror.properties()"); |
| 2714 |
| 2715 // Check that the properties are interceptor properties. |
| 2716 for (int i = 0; i < 2; i++) { |
| 2717 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
| 2718 OS::SNPrintF(buffer, |
| 2719 "indexed_values[%d] instanceof debug.PropertyMirror", i); |
| 2720 CHECK(CompileRun(buffer.start())->BooleanValue()); |
| 2721 } |
| 2722 |
2690 // Get the interceptor properties for the object with both types of | 2723 // Get the interceptor properties for the object with both types of |
2691 // interceptors. | 2724 // interceptors. |
2692 CompileRun("both_values = both_mirror.interceptorProperties()"); | 2725 CompileRun("both_values = both_mirror.properties()"); |
2693 | 2726 |
2694 // Check the mirror hierachy | 2727 // Check that the properties are interceptor properties. |
2695 source = "both_values[0] instanceof debug.PropertyMirror"; | 2728 for (int i = 0; i < 5; i++) { |
2696 CHECK(CompileRun(source)->BooleanValue()); | 2729 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
2697 | 2730 OS::SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i); |
2698 source = "both_values[0] instanceof debug.InterceptorPropertyMirror"; | 2731 CHECK(CompileRun(buffer.start())->BooleanValue()); |
2699 CHECK(CompileRun(source)->BooleanValue()); | 2732 } |
2700 | |
2701 source = "both_values[1] instanceof debug.InterceptorPropertyMirror"; | |
2702 CHECK(CompileRun(source)->BooleanValue()); | |
2703 | |
2704 source = "both_values[2] instanceof debug.InterceptorPropertyMirror"; | |
2705 CHECK(CompileRun(source)->BooleanValue()); | |
2706 | |
2707 source = "both_values[3] instanceof debug.PropertyMirror"; | |
2708 CHECK(CompileRun(source)->BooleanValue()); | |
2709 | |
2710 source = "both_values[3] instanceof debug.InterceptorPropertyMirror"; | |
2711 CHECK(CompileRun(source)->BooleanValue()); | |
2712 | |
2713 source = "both_values[4] instanceof debug.InterceptorPropertyMirror"; | |
2714 CHECK(CompileRun(source)->BooleanValue()); | |
2715 | 2733 |
2716 // Check the property names. | 2734 // Check the property names. |
2717 source = "both_values[0].name() == 'a'"; | 2735 source = "both_values[0].name() == 'a'"; |
2718 CHECK(CompileRun(source)->BooleanValue()); | 2736 CHECK(CompileRun(source)->BooleanValue()); |
2719 | 2737 |
2720 source = "both_values[1].name() == 'b'"; | 2738 source = "both_values[1].name() == 'b'"; |
2721 CHECK(CompileRun(source)->BooleanValue()); | 2739 CHECK(CompileRun(source)->BooleanValue()); |
2722 | 2740 |
2723 source = "both_values[2].name() == 'c'"; | 2741 source = "both_values[2].name() == 'c'"; |
2724 CHECK(CompileRun(source)->BooleanValue()); | 2742 CHECK(CompileRun(source)->BooleanValue()); |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3402 " CheckSourceLine(2)\n" | 3420 " CheckSourceLine(2)\n" |
3403 " CheckSourceLine(3)\n" | 3421 " CheckSourceLine(3)\n" |
3404 "}; f()"))->Run(); | 3422 "}; f()"))->Run(); |
3405 | 3423 |
3406 // Test that a parameter can be passed to a function called in the debugger. | 3424 // Test that a parameter can be passed to a function called in the debugger. |
3407 v8::Script::Compile(v8::String::New("CheckDataParameter()"))->Run(); | 3425 v8::Script::Compile(v8::String::New("CheckDataParameter()"))->Run(); |
3408 | 3426 |
3409 // Test that a function with closure can be run in the debugger. | 3427 // Test that a function with closure can be run in the debugger. |
3410 v8::Script::Compile(v8::String::New("CheckClosure()"))->Run(); | 3428 v8::Script::Compile(v8::String::New("CheckClosure()"))->Run(); |
3411 } | 3429 } |
OLD | NEW |