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 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2915 " var len = a.length;\n" | 2915 " var len = a.length;\n" |
2916 " for (var i = 0; i < len; i++) {\n" | 2916 " for (var i = 0; i < len; i++) {\n" |
2917 " y = 1;\n" | 2917 " y = 1;\n" |
2918 " x = a[i];\n" | 2918 " x = a[i];\n" |
2919 " }\n" | 2919 " }\n" |
2920 "}\n" | 2920 "}\n" |
2921 "y=0\n", | 2921 "y=0\n", |
2922 "foo"); | 2922 "foo"); |
2923 | 2923 |
2924 // Create array [0,1,2,3,4,5,6,7,8,9] | 2924 // Create array [0,1,2,3,4,5,6,7,8,9] |
2925 v8::Local<v8::Array> a = v8::Array::New(10); | 2925 v8::Local<v8::Array> a = v8::Array::New(env->GetIsolate(), 10); |
2926 for (int i = 0; i < 10; i++) { | 2926 for (int i = 0; i < 10; i++) { |
2927 a->Set(v8::Number::New(i), v8::Number::New(i)); | 2927 a->Set(v8::Number::New(i), v8::Number::New(i)); |
2928 } | 2928 } |
2929 | 2929 |
2930 // Call function without any break points to ensure inlining is in place. | 2930 // Call function without any break points to ensure inlining is in place. |
2931 const int kArgc = 1; | 2931 const int kArgc = 1; |
2932 v8::Handle<v8::Value> args[kArgc] = { a }; | 2932 v8::Handle<v8::Value> args[kArgc] = { a }; |
2933 foo->Call(env->Global(), kArgc, args); | 2933 foo->Call(env->Global(), kArgc, args); |
2934 | 2934 |
2935 // Set up break point and step through the function. | 2935 // Set up break point and step through the function. |
(...skipping 26 matching lines...) Expand all Loading... |
2962 " var len = a.length;\n" | 2962 " var len = a.length;\n" |
2963 " for (var i = 0; i < len; i++) {\n" | 2963 " for (var i = 0; i < len; i++) {\n" |
2964 " y = 1;\n" | 2964 " y = 1;\n" |
2965 " a[i] = 42;\n" | 2965 " a[i] = 42;\n" |
2966 " }\n" | 2966 " }\n" |
2967 "}\n" | 2967 "}\n" |
2968 "y=0\n", | 2968 "y=0\n", |
2969 "foo"); | 2969 "foo"); |
2970 | 2970 |
2971 // Create array [0,1,2,3,4,5,6,7,8,9] | 2971 // Create array [0,1,2,3,4,5,6,7,8,9] |
2972 v8::Local<v8::Array> a = v8::Array::New(10); | 2972 v8::Local<v8::Array> a = v8::Array::New(env->GetIsolate(), 10); |
2973 for (int i = 0; i < 10; i++) { | 2973 for (int i = 0; i < 10; i++) { |
2974 a->Set(v8::Number::New(i), v8::Number::New(i)); | 2974 a->Set(v8::Number::New(i), v8::Number::New(i)); |
2975 } | 2975 } |
2976 | 2976 |
2977 // Call function without any break points to ensure inlining is in place. | 2977 // Call function without any break points to ensure inlining is in place. |
2978 const int kArgc = 1; | 2978 const int kArgc = 1; |
2979 v8::Handle<v8::Value> args[kArgc] = { a }; | 2979 v8::Handle<v8::Value> args[kArgc] = { a }; |
2980 foo->Call(env->Global(), kArgc, args); | 2980 foo->Call(env->Global(), kArgc, args); |
2981 | 2981 |
2982 // Set up break point and step through the function. | 2982 // Set up break point and step through the function. |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4349 // Check that no DebugBreak events occured during the context creation. | 4349 // Check that no DebugBreak events occured during the context creation. |
4350 CHECK_EQ(0, break_point_hit_count); | 4350 CHECK_EQ(0, break_point_hit_count); |
4351 | 4351 |
4352 // Get rid of the debug event listener. | 4352 // Get rid of the debug event listener. |
4353 v8::Debug::SetDebugEventListener2(NULL); | 4353 v8::Debug::SetDebugEventListener2(NULL); |
4354 CheckDebuggerUnloaded(); | 4354 CheckDebuggerUnloaded(); |
4355 } | 4355 } |
4356 | 4356 |
4357 | 4357 |
4358 static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) { | 4358 static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) { |
4359 v8::Handle<v8::Array> result = v8::Array::New(3); | 4359 v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 3); |
4360 result->Set(v8::Integer::New(0), | 4360 result->Set(v8::Integer::New(0), |
4361 v8::String::NewFromUtf8(info.GetIsolate(), "a")); | 4361 v8::String::NewFromUtf8(info.GetIsolate(), "a")); |
4362 result->Set(v8::Integer::New(1), | 4362 result->Set(v8::Integer::New(1), |
4363 v8::String::NewFromUtf8(info.GetIsolate(), "b")); | 4363 v8::String::NewFromUtf8(info.GetIsolate(), "b")); |
4364 result->Set(v8::Integer::New(2), | 4364 result->Set(v8::Integer::New(2), |
4365 v8::String::NewFromUtf8(info.GetIsolate(), "c")); | 4365 v8::String::NewFromUtf8(info.GetIsolate(), "c")); |
4366 info.GetReturnValue().Set(result); | 4366 info.GetReturnValue().Set(result); |
4367 } | 4367 } |
4368 | 4368 |
4369 | 4369 |
4370 static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) { | 4370 static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) { |
4371 v8::Handle<v8::Array> result = v8::Array::New(2); | 4371 v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 2); |
4372 result->Set(v8::Integer::New(0), v8::Number::New(1)); | 4372 result->Set(v8::Integer::New(0), v8::Number::New(1)); |
4373 result->Set(v8::Integer::New(1), v8::Number::New(10)); | 4373 result->Set(v8::Integer::New(1), v8::Number::New(10)); |
4374 info.GetReturnValue().Set(result); | 4374 info.GetReturnValue().Set(result); |
4375 } | 4375 } |
4376 | 4376 |
4377 | 4377 |
4378 static void NamedGetter(v8::Local<v8::String> name, | 4378 static void NamedGetter(v8::Local<v8::String> name, |
4379 const v8::PropertyCallbackInfo<v8::Value>& info) { | 4379 const v8::PropertyCallbackInfo<v8::Value>& info) { |
4380 v8::String::Utf8Value n(name); | 4380 v8::String::Utf8Value n(name); |
4381 if (strcmp(*n, "a") == 0) { | 4381 if (strcmp(*n, "a") == 0) { |
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6244 ::v8::internal::EmbeddedVector<uint16_t, 1> empty_; | 6244 ::v8::internal::EmbeddedVector<uint16_t, 1> empty_; |
6245 }; | 6245 }; |
6246 | 6246 |
6247 | 6247 |
6248 TEST(DebugGetLoadedScripts) { | 6248 TEST(DebugGetLoadedScripts) { |
6249 DebugLocalContext env; | 6249 DebugLocalContext env; |
6250 v8::HandleScope scope(env->GetIsolate()); | 6250 v8::HandleScope scope(env->GetIsolate()); |
6251 env.ExposeDebug(); | 6251 env.ExposeDebug(); |
6252 | 6252 |
6253 EmptyExternalStringResource source_ext_str; | 6253 EmptyExternalStringResource source_ext_str; |
6254 v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str); | 6254 v8::Local<v8::String> source = |
| 6255 v8::String::NewExternal(env->GetIsolate(), &source_ext_str); |
6255 v8::Handle<v8::Script> evil_script(v8::Script::Compile(source)); | 6256 v8::Handle<v8::Script> evil_script(v8::Script::Compile(source)); |
6256 // "use" evil_script to make the compiler happy. | 6257 // "use" evil_script to make the compiler happy. |
6257 (void) evil_script; | 6258 (void) evil_script; |
6258 Handle<i::ExternalTwoByteString> i_source( | 6259 Handle<i::ExternalTwoByteString> i_source( |
6259 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); | 6260 i::ExternalTwoByteString::cast(*v8::Utils::OpenHandle(*source))); |
6260 // This situation can happen if source was an external string disposed | 6261 // This situation can happen if source was an external string disposed |
6261 // by its owner. | 6262 // by its owner. |
6262 i_source->set_resource(0); | 6263 i_source->set_resource(0); |
6263 | 6264 |
6264 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; | 6265 bool allow_natives_syntax = i::FLAG_allow_natives_syntax; |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7730 TEST(LiveEditDisabled) { | 7731 TEST(LiveEditDisabled) { |
7731 v8::internal::FLAG_allow_natives_syntax = true; | 7732 v8::internal::FLAG_allow_natives_syntax = true; |
7732 LocalContext env; | 7733 LocalContext env; |
7733 v8::HandleScope scope(env->GetIsolate()); | 7734 v8::HandleScope scope(env->GetIsolate()); |
7734 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); | 7735 v8::Debug::SetLiveEditEnabled(false), env->GetIsolate(); |
7735 CompileRun("%LiveEditCompareStrings('', '')"); | 7736 CompileRun("%LiveEditCompareStrings('', '')"); |
7736 } | 7737 } |
7737 | 7738 |
7738 | 7739 |
7739 #endif // ENABLE_DEBUGGER_SUPPORT | 7740 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |