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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 | 843 |
844 if (event == v8::Break) { | 844 if (event == v8::Break) { |
845 for (int i = 0; checks[i].expr != NULL; i++) { | 845 for (int i = 0; checks[i].expr != NULL; i++) { |
846 const int argc = 3; | 846 const int argc = 3; |
847 v8::Handle<v8::Value> argv[argc] = { exec_state, | 847 v8::Handle<v8::Value> argv[argc] = { exec_state, |
848 v8::String::New(checks[i].expr), | 848 v8::String::New(checks[i].expr), |
849 checks[i].expected }; | 849 checks[i].expected }; |
850 v8::Handle<v8::Value> result = | 850 v8::Handle<v8::Value> result = |
851 evaluate_check_function->Call(exec_state, argc, argv); | 851 evaluate_check_function->Call(exec_state, argc, argv); |
852 if (!result->IsTrue()) { | 852 if (!result->IsTrue()) { |
853 v8::String::AsciiValue ascii(checks[i].expected->ToString()); | 853 v8::String::Utf8Value utf8(checks[i].expected->ToString()); |
854 V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *ascii); | 854 V8_Fatal(__FILE__, __LINE__, "%s != %s", checks[i].expr, *utf8); |
855 } | 855 } |
856 } | 856 } |
857 } | 857 } |
858 } | 858 } |
859 | 859 |
860 | 860 |
861 // This debug event listener removes a breakpoint in a function | 861 // This debug event listener removes a breakpoint in a function |
862 int debug_event_remove_break_point = 0; | 862 int debug_event_remove_break_point = 0; |
863 static void DebugEventRemoveBreakPoint(v8::DebugEvent event, | 863 static void DebugEventRemoveBreakPoint(v8::DebugEvent event, |
864 v8::Handle<v8::Object> exec_state, | 864 v8::Handle<v8::Object> exec_state, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 916 |
917 if (event == v8::Break || event == v8::Exception) { | 917 if (event == v8::Break || event == v8::Exception) { |
918 // Check that the current function is the expected. | 918 // Check that the current function is the expected. |
919 CHECK(break_point_hit_count < | 919 CHECK(break_point_hit_count < |
920 StrLength(expected_step_sequence)); | 920 StrLength(expected_step_sequence)); |
921 const int argc = 2; | 921 const int argc = 2; |
922 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; | 922 v8::Handle<v8::Value> argv[argc] = { exec_state, v8::Integer::New(0) }; |
923 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, | 923 v8::Handle<v8::Value> result = frame_function_name->Call(exec_state, |
924 argc, argv); | 924 argc, argv); |
925 CHECK(result->IsString()); | 925 CHECK(result->IsString()); |
926 v8::String::AsciiValue function_name(result->ToString()); | 926 v8::String::Utf8Value function_name(result->ToString()); |
927 CHECK_EQ(1, StrLength(*function_name)); | 927 CHECK_EQ(1, StrLength(*function_name)); |
928 CHECK_EQ((*function_name)[0], | 928 CHECK_EQ((*function_name)[0], |
929 expected_step_sequence[break_point_hit_count]); | 929 expected_step_sequence[break_point_hit_count]); |
930 | 930 |
931 // Perform step. | 931 // Perform step. |
932 break_point_hit_count++; | 932 break_point_hit_count++; |
933 PrepareStep(step_action); | 933 PrepareStep(step_action); |
934 } | 934 } |
935 } | 935 } |
936 | 936 |
(...skipping 3341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4278 static v8::Handle<v8::Array> IndexedEnum(const v8::AccessorInfo&) { | 4278 static v8::Handle<v8::Array> IndexedEnum(const v8::AccessorInfo&) { |
4279 v8::Handle<v8::Array> result = v8::Array::New(2); | 4279 v8::Handle<v8::Array> result = v8::Array::New(2); |
4280 result->Set(v8::Integer::New(0), v8::Number::New(1)); | 4280 result->Set(v8::Integer::New(0), v8::Number::New(1)); |
4281 result->Set(v8::Integer::New(1), v8::Number::New(10)); | 4281 result->Set(v8::Integer::New(1), v8::Number::New(10)); |
4282 return result; | 4282 return result; |
4283 } | 4283 } |
4284 | 4284 |
4285 | 4285 |
4286 static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name, | 4286 static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name, |
4287 const v8::AccessorInfo& info) { | 4287 const v8::AccessorInfo& info) { |
4288 v8::String::AsciiValue n(name); | 4288 v8::String::Utf8Value n(name); |
4289 if (strcmp(*n, "a") == 0) { | 4289 if (strcmp(*n, "a") == 0) { |
4290 return v8::String::New("AA"); | 4290 return v8::String::New("AA"); |
4291 } else if (strcmp(*n, "b") == 0) { | 4291 } else if (strcmp(*n, "b") == 0) { |
4292 return v8::String::New("BB"); | 4292 return v8::String::New("BB"); |
4293 } else if (strcmp(*n, "c") == 0) { | 4293 } else if (strcmp(*n, "c") == 0) { |
4294 return v8::String::New("CC"); | 4294 return v8::String::New("CC"); |
4295 } else { | 4295 } else { |
4296 return v8::Undefined(); | 4296 return v8::Undefined(); |
4297 } | 4297 } |
4298 | 4298 |
(...skipping 2702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7001 | 7001 |
7002 v8::Handle<v8::Context> debugee_context; | 7002 v8::Handle<v8::Context> debugee_context; |
7003 v8::Handle<v8::Context> debugger_context; | 7003 v8::Handle<v8::Context> debugger_context; |
7004 | 7004 |
7005 | 7005 |
7006 // Property getter that checks that current and calling contexts | 7006 // Property getter that checks that current and calling contexts |
7007 // are both the debugee contexts. | 7007 // are both the debugee contexts. |
7008 static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck( | 7008 static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck( |
7009 v8::Local<v8::String> name, | 7009 v8::Local<v8::String> name, |
7010 const v8::AccessorInfo& info) { | 7010 const v8::AccessorInfo& info) { |
7011 CHECK_EQ(0, strcmp(*v8::String::AsciiValue(name), "a")); | 7011 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a")); |
7012 v8::Handle<v8::Context> current = v8::Context::GetCurrent(); | 7012 v8::Handle<v8::Context> current = v8::Context::GetCurrent(); |
7013 CHECK(current == debugee_context); | 7013 CHECK(current == debugee_context); |
7014 CHECK(current != debugger_context); | 7014 CHECK(current != debugger_context); |
7015 v8::Handle<v8::Context> calling = v8::Context::GetCalling(); | 7015 v8::Handle<v8::Context> calling = v8::Context::GetCalling(); |
7016 CHECK(calling == debugee_context); | 7016 CHECK(calling == debugee_context); |
7017 CHECK(calling != debugger_context); | 7017 CHECK(calling != debugger_context); |
7018 return v8::Int32::New(1); | 7018 return v8::Int32::New(1); |
7019 } | 7019 } |
7020 | 7020 |
7021 | 7021 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7560 TEST(LiveEditDisabled) { | 7560 TEST(LiveEditDisabled) { |
7561 v8::internal::FLAG_allow_natives_syntax = true; | 7561 v8::internal::FLAG_allow_natives_syntax = true; |
7562 LocalContext env; | 7562 LocalContext env; |
7563 v8::HandleScope scope(env->GetIsolate()); | 7563 v8::HandleScope scope(env->GetIsolate()); |
7564 v8::Debug::SetLiveEditEnabled(false); | 7564 v8::Debug::SetLiveEditEnabled(false); |
7565 CompileRun("%LiveEditCompareStrings('', '')"); | 7565 CompileRun("%LiveEditCompareStrings('', '')"); |
7566 } | 7566 } |
7567 | 7567 |
7568 | 7568 |
7569 #endif // ENABLE_DEBUGGER_SUPPORT | 7569 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |