OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 Handle<Script> i_script(Script::cast(shared_function->script())); | 74 Handle<Script> i_script(Script::cast(shared_function->script())); |
75 CHECK(i_script->source()->IsString()); | 75 CHECK(i_script->source()->IsString()); |
76 Handle<String> script_src(String::cast(i_script->source())); | 76 Handle<String> script_src(String::cast(i_script->source())); |
77 | 77 |
78 // Find the position of a given func source substring in the source. | 78 // Find the position of a given func source substring in the source. |
79 Handle<String> func_pos_str = | 79 Handle<String> func_pos_str = |
80 Factory::NewStringFromAscii(CStrVector(func_pos_src)); | 80 Factory::NewStringFromAscii(CStrVector(func_pos_src)); |
81 int func_pos = Runtime::StringMatch(script_src, func_pos_str, 0); | 81 int func_pos = Runtime::StringMatch(script_src, func_pos_str, 0); |
82 CHECK_NE(0, func_pos); | 82 CHECK_NE(0, func_pos); |
83 | 83 |
| 84 #ifdef ENABLE_DEBUGGER_SUPPORT |
84 // Obtain SharedFunctionInfo for the function. | 85 // Obtain SharedFunctionInfo for the function. |
85 Object* shared_func_info_ptr = | 86 Object* shared_func_info_ptr = |
86 Runtime::FindSharedFunctionInfoInScript(i_script, func_pos); | 87 Runtime::FindSharedFunctionInfoInScript(i_script, func_pos); |
87 CHECK(shared_func_info_ptr != Heap::undefined_value()); | 88 CHECK(shared_func_info_ptr != Heap::undefined_value()); |
88 Handle<SharedFunctionInfo> shared_func_info( | 89 Handle<SharedFunctionInfo> shared_func_info( |
89 SharedFunctionInfo::cast(shared_func_info_ptr)); | 90 SharedFunctionInfo::cast(shared_func_info_ptr)); |
90 | 91 |
91 // Verify inferred function name. | 92 // Verify inferred function name. |
92 SmartPointer<char> inferred_name = | 93 SmartPointer<char> inferred_name = |
93 shared_func_info->inferred_name()->ToCString(); | 94 shared_func_info->inferred_name()->ToCString(); |
94 CHECK_EQ(ref_inferred_name, *inferred_name); | 95 CHECK_EQ(ref_inferred_name, *inferred_name); |
| 96 #endif // ENABLE_DEBUGGER_SUPPORT |
95 } | 97 } |
96 | 98 |
97 | 99 |
98 static v8::Handle<v8::Script> Compile(const char* src) { | 100 static v8::Handle<v8::Script> Compile(const char* src) { |
99 return v8::Script::Compile(v8::String::New(src)); | 101 return v8::Script::Compile(v8::String::New(src)); |
100 } | 102 } |
101 | 103 |
102 | 104 |
103 TEST(GlobalProperty) { | 105 TEST(GlobalProperty) { |
104 InitializeVM(); | 106 InitializeVM(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 InitializeVM(); | 268 InitializeVM(); |
267 v8::HandleScope scope; | 269 v8::HandleScope scope; |
268 | 270 |
269 v8::Handle<v8::Script> script = Compile( | 271 v8::Handle<v8::Script> script = Compile( |
270 "function a() {\n" | 272 "function a() {\n" |
271 "var result = function(p,a,c,k,e,d)" | 273 "var result = function(p,a,c,k,e,d)" |
272 "{return p}(\"if blah blah\",62,1976,\'a|b\'.split(\'|\'),0,{})\n" | 274 "{return p}(\"if blah blah\",62,1976,\'a|b\'.split(\'|\'),0,{})\n" |
273 "}"); | 275 "}"); |
274 CheckFunctionName(script, "return p", ""); | 276 CheckFunctionName(script, "return p", ""); |
275 } | 277 } |
OLD | NEW |