| 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 12911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12922 | 12922 |
| 12923 | 12923 |
| 12924 static void ChildGetter(Local<String> name, | 12924 static void ChildGetter(Local<String> name, |
| 12925 const v8::PropertyCallbackInfo<v8::Value>& info) { | 12925 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 12926 ApiTestFuzzer::Fuzz(); | 12926 ApiTestFuzzer::Fuzz(); |
| 12927 info.GetReturnValue().Set(v8_num(42)); | 12927 info.GetReturnValue().Set(v8_num(42)); |
| 12928 } | 12928 } |
| 12929 | 12929 |
| 12930 | 12930 |
| 12931 THREADED_TEST(Overriding) { | 12931 THREADED_TEST(Overriding) { |
| 12932 i::FLAG_es5_readonly = true; | |
| 12933 LocalContext context; | 12932 LocalContext context; |
| 12934 v8::Isolate* isolate = context->GetIsolate(); | 12933 v8::Isolate* isolate = context->GetIsolate(); |
| 12935 v8::HandleScope scope(isolate); | 12934 v8::HandleScope scope(isolate); |
| 12936 | 12935 |
| 12937 // Parent template. | 12936 // Parent template. |
| 12938 Local<v8::FunctionTemplate> parent_templ = v8::FunctionTemplate::New(isolate); | 12937 Local<v8::FunctionTemplate> parent_templ = v8::FunctionTemplate::New(isolate); |
| 12939 Local<ObjectTemplate> parent_instance_templ = | 12938 Local<ObjectTemplate> parent_instance_templ = |
| 12940 parent_templ->InstanceTemplate(); | 12939 parent_templ->InstanceTemplate(); |
| 12941 parent_instance_templ->SetAccessor(v8_str("f"), ParentGetter); | 12940 parent_instance_templ->SetAccessor(v8_str("f"), ParentGetter); |
| 12942 | 12941 |
| (...skipping 2250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15193 regexp_interruption_data.string.Reset(); | 15192 regexp_interruption_data.string.Reset(); |
| 15194 i::DeleteArray(uc16_content); | 15193 i::DeleteArray(uc16_content); |
| 15195 } | 15194 } |
| 15196 | 15195 |
| 15197 #endif // V8_INTERPRETED_REGEXP | 15196 #endif // V8_INTERPRETED_REGEXP |
| 15198 | 15197 |
| 15199 | 15198 |
| 15200 // Test that we cannot set a property on the global object if there | 15199 // Test that we cannot set a property on the global object if there |
| 15201 // is a read-only property in the prototype chain. | 15200 // is a read-only property in the prototype chain. |
| 15202 TEST(ReadOnlyPropertyInGlobalProto) { | 15201 TEST(ReadOnlyPropertyInGlobalProto) { |
| 15203 i::FLAG_es5_readonly = true; | |
| 15204 v8::Isolate* isolate = CcTest::isolate(); | 15202 v8::Isolate* isolate = CcTest::isolate(); |
| 15205 v8::HandleScope scope(isolate); | 15203 v8::HandleScope scope(isolate); |
| 15206 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); | 15204 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); |
| 15207 LocalContext context(0, templ); | 15205 LocalContext context(0, templ); |
| 15208 v8::Handle<v8::Object> global = context->Global(); | 15206 v8::Handle<v8::Object> global = context->Global(); |
| 15209 v8::Handle<v8::Object> global_proto = | 15207 v8::Handle<v8::Object> global_proto = |
| 15210 v8::Handle<v8::Object>::Cast(global->Get(v8_str("__proto__"))); | 15208 v8::Handle<v8::Object>::Cast(global->Get(v8_str("__proto__"))); |
| 15211 global_proto->Set(v8_str("x"), v8::Integer::New(isolate, 0), v8::ReadOnly); | 15209 global_proto->Set(v8_str("x"), v8::Integer::New(isolate, 0), v8::ReadOnly); |
| 15212 global_proto->Set(v8_str("y"), v8::Integer::New(isolate, 0), v8::ReadOnly); | 15210 global_proto->Set(v8_str("y"), v8::Integer::New(isolate, 0), v8::ReadOnly); |
| 15213 // Check without 'eval' or 'with'. | 15211 // Check without 'eval' or 'with'. |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15548 calling_context2->Exit(); | 15546 calling_context2->Exit(); |
| 15549 ::calling_context0.Clear(); | 15547 ::calling_context0.Clear(); |
| 15550 ::calling_context1.Clear(); | 15548 ::calling_context1.Clear(); |
| 15551 ::calling_context2.Clear(); | 15549 ::calling_context2.Clear(); |
| 15552 } | 15550 } |
| 15553 | 15551 |
| 15554 | 15552 |
| 15555 // Check that a variable declaration with no explicit initialization | 15553 // Check that a variable declaration with no explicit initialization |
| 15556 // value does shadow an existing property in the prototype chain. | 15554 // value does shadow an existing property in the prototype chain. |
| 15557 THREADED_TEST(InitGlobalVarInProtoChain) { | 15555 THREADED_TEST(InitGlobalVarInProtoChain) { |
| 15558 i::FLAG_es52_globals = true; | |
| 15559 LocalContext context; | 15556 LocalContext context; |
| 15560 v8::HandleScope scope(context->GetIsolate()); | 15557 v8::HandleScope scope(context->GetIsolate()); |
| 15561 // Introduce a variable in the prototype chain. | 15558 // Introduce a variable in the prototype chain. |
| 15562 CompileRun("__proto__.x = 42"); | 15559 CompileRun("__proto__.x = 42"); |
| 15563 v8::Handle<v8::Value> result = CompileRun("var x = 43; x"); | 15560 v8::Handle<v8::Value> result = CompileRun("var x = 43; x"); |
| 15564 CHECK(!result->IsUndefined()); | 15561 CHECK(!result->IsUndefined()); |
| 15565 CHECK_EQ(43, result->Int32Value()); | 15562 CHECK_EQ(43, result->Int32Value()); |
| 15566 } | 15563 } |
| 15567 | 15564 |
| 15568 | 15565 |
| (...skipping 6540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22109 Local<Object> ApiCallOptimizationChecker::holder; | 22106 Local<Object> ApiCallOptimizationChecker::holder; |
| 22110 Local<Object> ApiCallOptimizationChecker::callee; | 22107 Local<Object> ApiCallOptimizationChecker::callee; |
| 22111 int ApiCallOptimizationChecker::count = 0; | 22108 int ApiCallOptimizationChecker::count = 0; |
| 22112 | 22109 |
| 22113 | 22110 |
| 22114 TEST(TestFunctionCallOptimization) { | 22111 TEST(TestFunctionCallOptimization) { |
| 22115 i::FLAG_allow_natives_syntax = true; | 22112 i::FLAG_allow_natives_syntax = true; |
| 22116 ApiCallOptimizationChecker checker; | 22113 ApiCallOptimizationChecker checker; |
| 22117 checker.RunAll(); | 22114 checker.RunAll(); |
| 22118 } | 22115 } |
| OLD | NEW |