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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "test/cctest/test-api.h" | 7 #include "test/cctest/test-api.h" |
8 | 8 |
9 #include "include/v8-util.h" | 9 #include "include/v8-util.h" |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 | 1000 |
1001 // Indexed and named deleter. | 1001 // Indexed and named deleter. |
1002 CompileRun("delete obj[0]"); | 1002 CompileRun("delete obj[0]"); |
1003 CompileRun("delete obj.x"); | 1003 CompileRun("delete obj.x"); |
1004 | 1004 |
1005 // Enumerators. | 1005 // Enumerators. |
1006 CompileRun("for (var p in obj) ;"); | 1006 CompileRun("for (var p in obj) ;"); |
1007 } | 1007 } |
1008 | 1008 |
1009 | 1009 |
1010 bool is_bootstrapping = true; | 1010 bool is_bootstrapping = false; |
1011 static void PrePropertyHandlerGet( | 1011 static void PrePropertyHandlerGet( |
1012 Local<Name> key, const v8::PropertyCallbackInfo<v8::Value>& info) { | 1012 Local<Name> key, const v8::PropertyCallbackInfo<v8::Value>& info) { |
1013 ApiTestFuzzer::Fuzz(); | 1013 ApiTestFuzzer::Fuzz(); |
1014 if (!is_bootstrapping && v8_str("pre")->Equals(key)) { | 1014 if (!is_bootstrapping && v8_str("pre")->Equals(key)) { |
1015 info.GetReturnValue().Set(v8_str("PrePropertyHandler: pre")); | 1015 info.GetReturnValue().Set(v8_str("PrePropertyHandler: pre")); |
1016 } | 1016 } |
1017 } | 1017 } |
1018 | 1018 |
1019 | 1019 |
1020 static void PrePropertyHandlerQuery( | 1020 static void PrePropertyHandlerQuery( |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 // Test interceptor load/call IC where the interceptor throws an | 2597 // Test interceptor load/call IC where the interceptor throws an |
2598 // exception once in a while. | 2598 // exception once in a while. |
2599 THREADED_TEST(InterceptorICGetterExceptions) { | 2599 THREADED_TEST(InterceptorICGetterExceptions) { |
2600 interceptor_ic_exception_get_count = 0; | 2600 interceptor_ic_exception_get_count = 0; |
2601 v8::Isolate* isolate = CcTest::isolate(); | 2601 v8::Isolate* isolate = CcTest::isolate(); |
2602 v8::HandleScope scope(isolate); | 2602 v8::HandleScope scope(isolate); |
2603 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); | 2603 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); |
2604 // Generous limit for bootstrapping. | 2604 // Generous limit for bootstrapping. |
2605 templ->SetHandler( | 2605 templ->SetHandler( |
2606 v8::NamedPropertyHandlerConfiguration(InterceptorICExceptionGetter)); | 2606 v8::NamedPropertyHandlerConfiguration(InterceptorICExceptionGetter)); |
| 2607 is_bootstrapping = true; |
2607 LocalContext context(0, templ, v8::Handle<Value>()); | 2608 LocalContext context(0, templ, v8::Handle<Value>()); |
| 2609 is_bootstrapping = false; |
2608 call_ic_function3 = v8_compile("function h(x) { return x; }; h")->Run(); | 2610 call_ic_function3 = v8_compile("function h(x) { return x; }; h")->Run(); |
2609 v8::Handle<Value> value = CompileRun( | 2611 v8::Handle<Value> value = CompileRun( |
2610 "function f() {" | 2612 "function f() {" |
2611 " for (var i = 0; i < 100; i++) {" | 2613 " for (var i = 0; i < 100; i++) {" |
2612 " try { x; } catch(e) { return true; }" | 2614 " try { x; } catch(e) { return true; }" |
2613 " }" | 2615 " }" |
2614 " return false;" | 2616 " return false;" |
2615 "};" | 2617 "};" |
2616 "f();"); | 2618 "f();"); |
2617 CHECK_EQ(true, value->BooleanValue()); | 2619 CHECK_EQ(true, value->BooleanValue()); |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 "var obj = intercepted_1;" | 3316 "var obj = intercepted_1;" |
3315 "obj.x = 4;" | 3317 "obj.x = 4;" |
3316 "eval('obj.x');" | 3318 "eval('obj.x');" |
3317 "eval('obj.x');" | 3319 "eval('obj.x');" |
3318 "eval('obj.x');" | 3320 "eval('obj.x');" |
3319 "obj = intercepted_2;" | 3321 "obj = intercepted_2;" |
3320 "obj.x = 9;" | 3322 "obj.x = 9;" |
3321 "eval('obj.x');", | 3323 "eval('obj.x');", |
3322 9); | 3324 9); |
3323 } | 3325 } |
OLD | NEW |