OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4567 const char* source; | 4567 const char* source; |
4568 source = "named_mirror.properties().length"; | 4568 source = "named_mirror.properties().length"; |
4569 CHECK_EQ(3, CompileRun(source)->Int32Value(context).FromJust()); | 4569 CHECK_EQ(3, CompileRun(source)->Int32Value(context).FromJust()); |
4570 | 4570 |
4571 source = "indexed_mirror.properties().length"; | 4571 source = "indexed_mirror.properties().length"; |
4572 CHECK_EQ(2, CompileRun(source)->Int32Value(context).FromJust()); | 4572 CHECK_EQ(2, CompileRun(source)->Int32Value(context).FromJust()); |
4573 | 4573 |
4574 source = "both_mirror.properties().length"; | 4574 source = "both_mirror.properties().length"; |
4575 CHECK_EQ(5, CompileRun(source)->Int32Value(context).FromJust()); | 4575 CHECK_EQ(5, CompileRun(source)->Int32Value(context).FromJust()); |
4576 | 4576 |
4577 // 1 is PropertyKind.Named; | |
Jakob Kummerow
2015/12/04 13:39:29
The Named/Indexed distinction is no longer support
| |
4578 source = "both_mirror.properties(1).length"; | |
4579 CHECK_EQ(3, CompileRun(source)->Int32Value(context).FromJust()); | |
4580 | |
4581 // 2 is PropertyKind.Indexed; | |
4582 source = "both_mirror.properties(2).length"; | |
4583 CHECK_EQ(2, CompileRun(source)->Int32Value(context).FromJust()); | |
4584 | |
4585 // 3 is PropertyKind.Named | PropertyKind.Indexed; | |
4586 source = "both_mirror.properties(3).length"; | |
4587 CHECK_EQ(5, CompileRun(source)->Int32Value(context).FromJust()); | |
4588 | |
4589 // Get the interceptor properties for the object with only named interceptor. | 4577 // Get the interceptor properties for the object with only named interceptor. |
4590 CompileRun("var named_values = named_mirror.properties()"); | 4578 CompileRun("var named_values = named_mirror.properties()"); |
4591 | 4579 |
4592 // Check that the properties are interceptor properties. | 4580 // Check that the properties are interceptor properties. |
4593 for (int i = 0; i < 3; i++) { | 4581 for (int i = 0; i < 3; i++) { |
4594 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 4582 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
4595 SNPrintF(buffer, | 4583 SNPrintF(buffer, |
4596 "named_values[%d] instanceof debug.PropertyMirror", i); | 4584 "named_values[%d] instanceof debug.PropertyMirror", i); |
4597 CHECK(CompileRun(buffer.start())->BooleanValue(context).FromJust()); | 4585 CHECK(CompileRun(buffer.start())->BooleanValue(context).FromJust()); |
4598 | 4586 |
(...skipping 18 matching lines...) Expand all Loading... | |
4617 CompileRun("var both_values = both_mirror.properties()"); | 4605 CompileRun("var both_values = both_mirror.properties()"); |
4618 | 4606 |
4619 // Check that the properties are interceptor properties. | 4607 // Check that the properties are interceptor properties. |
4620 for (int i = 0; i < 5; i++) { | 4608 for (int i = 0; i < 5; i++) { |
4621 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; | 4609 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; |
4622 SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i); | 4610 SNPrintF(buffer, "both_values[%d] instanceof debug.PropertyMirror", i); |
4623 CHECK(CompileRun(buffer.start())->BooleanValue(context).FromJust()); | 4611 CHECK(CompileRun(buffer.start())->BooleanValue(context).FromJust()); |
4624 } | 4612 } |
4625 | 4613 |
4626 // Check the property names. | 4614 // Check the property names. |
4627 source = "both_values[0].name() == 'a'"; | 4615 source = "both_values[0].name() == '1'"; |
Jakob Kummerow
2015/12/04 13:39:29
Enumeration order as defined by the spec.
| |
4628 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); | 4616 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); |
4629 | 4617 |
4630 source = "both_values[1].name() == 'b'"; | 4618 source = "both_values[1].name() == '10'"; |
4631 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); | 4619 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); |
4632 | 4620 |
4633 source = "both_values[2].name() == 'c'"; | 4621 source = "both_values[2].name() == 'a'"; |
4634 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); | 4622 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); |
4635 | 4623 |
4636 source = "both_values[3].name() == 1"; | 4624 source = "both_values[3].name() == 'b'"; |
4637 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); | 4625 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); |
4638 | 4626 |
4639 source = "both_values[4].name() == 10"; | 4627 source = "both_values[4].name() == 'c'"; |
4640 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); | 4628 CHECK(CompileRun(source)->BooleanValue(context).FromJust()); |
4641 } | 4629 } |
4642 | 4630 |
4643 | 4631 |
4644 TEST(HiddenPrototypePropertyMirror) { | 4632 TEST(HiddenPrototypePropertyMirror) { |
4645 // Create a V8 environment with debug access. | 4633 // Create a V8 environment with debug access. |
4646 DebugLocalContext env; | 4634 DebugLocalContext env; |
4647 v8::Isolate* isolate = env->GetIsolate(); | 4635 v8::Isolate* isolate = env->GetIsolate(); |
4648 v8::HandleScope scope(isolate); | 4636 v8::HandleScope scope(isolate); |
4649 env.ExposeDebug(); | 4637 env.ExposeDebug(); |
(...skipping 3416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8066 CompileRun("function foo() {}; foo();"); | 8054 CompileRun("function foo() {}; foo();"); |
8067 --after_compile_handler_depth; | 8055 --after_compile_handler_depth; |
8068 } | 8056 } |
8069 | 8057 |
8070 | 8058 |
8071 TEST(NoInterruptsInDebugListener) { | 8059 TEST(NoInterruptsInDebugListener) { |
8072 DebugLocalContext env; | 8060 DebugLocalContext env; |
8073 v8::Debug::SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent); | 8061 v8::Debug::SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent); |
8074 CompileRun("void(0);"); | 8062 CompileRun("void(0);"); |
8075 } | 8063 } |
OLD | NEW |