Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: test/cctest/test-func-name-inference.cc

Issue 10914065: Fix FindSharedFunctionInfoInScript to not optimize. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "api.h" 30 #include "api.h"
31 #include "debug.h"
31 #include "runtime.h" 32 #include "runtime.h"
32 #include "cctest.h" 33 #include "cctest.h"
33 34
34 35
35 using ::v8::internal::CStrVector; 36 using ::v8::internal::CStrVector;
36 using ::v8::internal::Factory; 37 using ::v8::internal::Factory;
37 using ::v8::internal::Handle; 38 using ::v8::internal::Handle;
38 using ::v8::internal::Heap; 39 using ::v8::internal::Heap;
39 using ::v8::internal::Isolate; 40 using ::v8::internal::Isolate;
40 using ::v8::internal::JSFunction; 41 using ::v8::internal::JSFunction;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 Handle<String> func_pos_str = 81 Handle<String> func_pos_str =
81 FACTORY->NewStringFromAscii(CStrVector(func_pos_src)); 82 FACTORY->NewStringFromAscii(CStrVector(func_pos_src));
82 int func_pos = Runtime::StringMatch(Isolate::Current(), 83 int func_pos = Runtime::StringMatch(Isolate::Current(),
83 script_src, 84 script_src,
84 func_pos_str, 85 func_pos_str,
85 0); 86 0);
86 CHECK_NE(0, func_pos); 87 CHECK_NE(0, func_pos);
87 88
88 #ifdef ENABLE_DEBUGGER_SUPPORT 89 #ifdef ENABLE_DEBUGGER_SUPPORT
89 // Obtain SharedFunctionInfo for the function. 90 // Obtain SharedFunctionInfo for the function.
91 Isolate::Current()->debug()->PrepareForBreakPoints();
90 Object* shared_func_info_ptr = 92 Object* shared_func_info_ptr =
91 Runtime::FindSharedFunctionInfoInScript(Isolate::Current(), 93 Isolate::Current()->debug()->FindSharedFunctionInfoInScript(i_script,
92 i_script, 94 func_pos);
93 func_pos);
94 CHECK(shared_func_info_ptr != HEAP->undefined_value()); 95 CHECK(shared_func_info_ptr != HEAP->undefined_value());
95 Handle<SharedFunctionInfo> shared_func_info( 96 Handle<SharedFunctionInfo> shared_func_info(
96 SharedFunctionInfo::cast(shared_func_info_ptr)); 97 SharedFunctionInfo::cast(shared_func_info_ptr));
97 98
98 // Verify inferred function name. 99 // Verify inferred function name.
99 SmartArrayPointer<char> inferred_name = 100 SmartArrayPointer<char> inferred_name =
100 shared_func_info->inferred_name()->ToCString(); 101 shared_func_info->inferred_name()->ToCString();
101 CHECK_EQ(ref_inferred_name, *inferred_name); 102 CHECK_EQ(ref_inferred_name, *inferred_name);
102 #endif // ENABLE_DEBUGGER_SUPPORT 103 #endif // ENABLE_DEBUGGER_SUPPORT
103 } 104 }
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 " };\n" 434 " };\n"
434 " var foo = 10;\n" 435 " var foo = 10;\n"
435 " function f() {\n" 436 " function f() {\n"
436 " return wrapCode();\n" 437 " return wrapCode();\n"
437 " }\n" 438 " }\n"
438 " this.ref = f;\n" 439 " this.ref = f;\n"
439 "})()"); 440 "})()");
440 script->Run(); 441 script->Run();
441 CheckFunctionName(script, "return 2012", ""); 442 CheckFunctionName(script, "return 2012", "");
442 } 443 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698