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 || i::FLAG_optimize_for_size) return; | 31 if (i::FLAG_always_opt) return; |
32 | 32 |
33 v8::Isolate* isolate = CcTest::isolate(); | 33 v8::Isolate* isolate = CcTest::isolate(); |
34 v8::HandleScope scope(isolate); | 34 v8::HandleScope scope(isolate); |
35 LocalContext env; | 35 LocalContext env; |
36 | 36 |
37 // We emulate Embedder-created DOM Node instances. Specifically: | 37 // We emulate Embedder-created DOM Node instances. Specifically: |
38 // - 'parent': FunctionTemplate ~= DOM Node superclass | 38 // - 'parent': FunctionTemplate ~= DOM Node superclass |
39 // - 'child': FunctionTemplate ~= a specific DOM node type, like a <div /> | 39 // - 'child': FunctionTemplate ~= a specific DOM node type, like a <div /> |
40 // | 40 // |
41 // We'll install both a C++-based and a JS-based accessor on the parent, | 41 // We'll install both a C++-based and a JS-based accessor on the parent, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 "var g = Object.getOwnPropertyDescriptor(" | 106 "var g = Object.getOwnPropertyDescriptor(" |
107 " n.__proto__.__proto__, 'firstChildRaw')['get'];" | 107 " n.__proto__.__proto__, 'firstChildRaw')['get'];" |
108 "try {" | 108 "try {" |
109 " var f = { firstChildRaw: '51' };" | 109 " var f = { firstChildRaw: '51' };" |
110 " g.apply(f);" | 110 " g.apply(f);" |
111 "} catch(e) {" | 111 "} catch(e) {" |
112 " 31415;" | 112 " 31415;" |
113 "}", | 113 "}", |
114 31415); | 114 31415); |
115 } | 115 } |
OLD | NEW |