| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 // Flags: --allow-natives-syntax | 5 #ifndef V8_LIBSAMPLER_UTILS_H_ |
| 6 #define V8_LIBSAMPLER_UTILS_H_ |
| 6 | 7 |
| 7 (function() { | 8 #include "include/v8.h" |
| 8 'use strict'; | 9 |
| 9 class A extends Function { | 10 namespace v8 { |
| 10 constructor(...args) { | 11 namespace sampler { |
| 11 super(...args); | 12 |
| 12 this.a = 42; | 13 class Malloced { |
| 13 } | 14 public: |
| 15 static void* New(size_t size) { |
| 16 return malloc(size); |
| 14 } | 17 } |
| 15 var v1 = new A("'use strict';"); | 18 |
| 16 function f(func) { | 19 static void Delete(void* p) { |
| 17 func.__defineSetter__('a', function() { }); | 20 free(p); |
| 18 } | 21 } |
| 19 var v2 = new A(); | 22 }; |
| 20 f(v2); | 23 |
| 21 f(v1); | 24 } // namespace sampler |
| 22 })(); | 25 } // namespace v8 |
| 26 |
| 27 #endif // V8_LIBSAMPLER_UTILS_H_ |
| OLD | NEW |