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

Side by Side Diff: test/cctest/compiler/test-loop-assignment-analysis.cc

Issue 669663003: Fix windows build. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/ast-loop-assignment-analyzer.h" 5 #include "src/compiler/ast-loop-assignment-analyzer.h"
6 #include "src/parser.h" 6 #include "src/parser.h"
7 #include "src/rewriter.h" 7 #include "src/rewriter.h"
8 #include "src/scopes.h" 8 #include "src/scopes.h"
9 #include "test/cctest/cctest.h" 9 #include "test/cctest/cctest.h"
10 10
11 using namespace v8::internal; 11 using namespace v8::internal;
12 using namespace v8::internal::compiler; 12 using namespace v8::internal::compiler;
13 13
14 namespace { 14 namespace {
15 const int kBufferSize = 1024; 15 const int kBufferSize = 1024;
16 16
17 struct TestHelper : public HandleAndZoneScope { 17 struct TestHelper : public HandleAndZoneScope {
18 char buffer[kBufferSize];
19 Handle<JSFunction> function; 18 Handle<JSFunction> function;
20 LoopAssignmentAnalysis* result; 19 LoopAssignmentAnalysis* result;
21 20
22 explicit TestHelper(const char* body) 21 explicit TestHelper(const char* body)
23 : function(Handle<JSFunction>::null()), result(NULL) { 22 : function(Handle<JSFunction>::null()), result(NULL) {
24 snprintf(buffer, kBufferSize, "function f(a,b,c) { %s; } f;", body); 23 ScopedVector<char> program(kBufferSize);
25 v8::Local<v8::Value> v = CompileRun(buffer); 24 SNPrintF(program, "function f(a,b,c) { %s; } f;", body);
25 v8::Local<v8::Value> v = CompileRun(program.start());
26 Handle<Object> obj = v8::Utils::OpenHandle(*v); 26 Handle<Object> obj = v8::Utils::OpenHandle(*v);
27 function = Handle<JSFunction>::cast(obj); 27 function = Handle<JSFunction>::cast(obj);
28 } 28 }
29 29
30 void CheckLoopAssignedCount(int expected, const char* var_name) { 30 void CheckLoopAssignedCount(int expected, const char* var_name) {
31 // TODO(titzer): don't scope analyze every single time. 31 // TODO(titzer): don't scope analyze every single time.
32 CompilationInfo info(function, main_zone()); 32 CompilationInfo info(function, main_zone());
33 33
34 CHECK(Parser::Parse(&info)); 34 CHECK(Parser::Parse(&info));
35 CHECK(Rewriter::Rewrite(&info)); 35 CHECK(Rewriter::Rewrite(&info));
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 " while (1) z++;" 285 " while (1) z++;"
286 " }" 286 " }"
287 "}" 287 "}"
288 "w;"); 288 "w;");
289 289
290 f.CheckLoopAssignedCount(1, "x"); 290 f.CheckLoopAssignedCount(1, "x");
291 f.CheckLoopAssignedCount(3, "y"); 291 f.CheckLoopAssignedCount(3, "y");
292 f.CheckLoopAssignedCount(5, "z"); 292 f.CheckLoopAssignedCount(5, "z");
293 f.CheckLoopAssignedCount(0, "w"); 293 f.CheckLoopAssignedCount(0, "w");
294 } 294 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698