OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } else { | 63 } else { |
64 shared_function = | 64 shared_function = |
65 Handle<SharedFunctionInfo>(JSFunction::cast(*obj)->shared()); | 65 Handle<SharedFunctionInfo>(JSFunction::cast(*obj)->shared()); |
66 } | 66 } |
67 Handle<Script> i_script(Script::cast(shared_function->script())); | 67 Handle<Script> i_script(Script::cast(shared_function->script())); |
68 CHECK(i_script->source()->IsString()); | 68 CHECK(i_script->source()->IsString()); |
69 Handle<String> script_src(String::cast(i_script->source())); | 69 Handle<String> script_src(String::cast(i_script->source())); |
70 | 70 |
71 // Find the position of a given func source substring in the source. | 71 // Find the position of a given func source substring in the source. |
72 Handle<String> func_pos_str = | 72 Handle<String> func_pos_str = |
73 factory->NewStringFromAscii(CStrVector(func_pos_src)); | 73 factory->NewStringFromAsciiChecked(func_pos_src); |
74 int func_pos = Runtime::StringMatch(isolate, | 74 int func_pos = Runtime::StringMatch(isolate, |
75 script_src, | 75 script_src, |
76 func_pos_str, | 76 func_pos_str, |
77 0); | 77 0); |
78 CHECK_NE(0, func_pos); | 78 CHECK_NE(0, func_pos); |
79 | 79 |
80 #ifdef ENABLE_DEBUGGER_SUPPORT | 80 #ifdef ENABLE_DEBUGGER_SUPPORT |
81 // Obtain SharedFunctionInfo for the function. | 81 // Obtain SharedFunctionInfo for the function. |
82 isolate->debug()->PrepareForBreakPoints(); | 82 isolate->debug()->PrepareForBreakPoints(); |
83 Object* shared_func_info_ptr = | 83 Object* shared_func_info_ptr = |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 " };\n" | 499 " };\n" |
500 " var foo = 10;\n" | 500 " var foo = 10;\n" |
501 " function f() {\n" | 501 " function f() {\n" |
502 " return wrapCode();\n" | 502 " return wrapCode();\n" |
503 " }\n" | 503 " }\n" |
504 " this.ref = f;\n" | 504 " this.ref = f;\n" |
505 "})()"); | 505 "})()"); |
506 script->Run(); | 506 script->Run(); |
507 CheckFunctionName(script, "return 2012", ""); | 507 CheckFunctionName(script, "return 2012", ""); |
508 } | 508 } |
OLD | NEW |