OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/cctest/cctest.h" | 5 #include "test/cctest/cctest.h" |
6 | 6 |
7 #include "include/v8.h" | 7 #include "include/v8.h" |
8 #include "include/v8-experimental.h" | 8 #include "include/v8-experimental.h" |
9 | 9 |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 | 22 |
23 v8::experimental::FastAccessorBuilder* FastAccessor(v8::Isolate* isolate) { | 23 v8::experimental::FastAccessorBuilder* FastAccessor(v8::Isolate* isolate) { |
24 auto builder = v8::experimental::FastAccessorBuilder::New(isolate); | 24 auto builder = v8::experimental::FastAccessorBuilder::New(isolate); |
25 builder->ReturnValue(builder->IntegerConstant(41)); | 25 builder->ReturnValue(builder->IntegerConstant(41)); |
26 return builder; | 26 return builder; |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 TEST(FastAccessors) { | 30 TEST(FastAccessors) { |
31 if (i::FLAG_always_opt) return; | |
32 | |
33 v8::Isolate* isolate = CcTest::isolate(); | 31 v8::Isolate* isolate = CcTest::isolate(); |
34 v8::HandleScope scope(isolate); | 32 v8::HandleScope scope(isolate); |
35 LocalContext env; | 33 LocalContext env; |
36 | 34 |
37 // We emulate Embedder-created DOM Node instances. Specifically: | 35 // We emulate Embedder-created DOM Node instances. Specifically: |
38 // - 'parent': FunctionTemplate ~= DOM Node superclass | 36 // - 'parent': FunctionTemplate ~= DOM Node superclass |
39 // - 'child': FunctionTemplate ~= a specific DOM node type, like a <div /> | 37 // - 'child': FunctionTemplate ~= a specific DOM node type, like a <div /> |
40 // | 38 // |
41 // We'll install both a C++-based and a JS-based accessor on the parent, | 39 // We'll install both a C++-based and a JS-based accessor on the parent, |
42 // and expect it to be callable on the child. | 40 // and expect it to be callable on the child. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 "var g = Object.getOwnPropertyDescriptor(" | 104 "var g = Object.getOwnPropertyDescriptor(" |
107 " n.__proto__.__proto__, 'firstChildRaw')['get'];" | 105 " n.__proto__.__proto__, 'firstChildRaw')['get'];" |
108 "try {" | 106 "try {" |
109 " var f = { firstChildRaw: '51' };" | 107 " var f = { firstChildRaw: '51' };" |
110 " g.apply(f);" | 108 " g.apply(f);" |
111 "} catch(e) {" | 109 "} catch(e) {" |
112 " 31415;" | 110 " 31415;" |
113 "}", | 111 "}", |
114 31415); | 112 31415); |
115 } | 113 } |
OLD | NEW |