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

Side by Side Diff: src/asmjs/asm-typer.cc

Issue 2526703002: [wasm] [asmjs] Route asm.js warnings to the dev console. (Closed)
Patch Set: fix Created 4 years 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/asmjs/asm-typer.h" 5 #include "src/asmjs/asm-typer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "src/v8.h" 12 #include "src/v8.h"
13 13
14 #include "src/asmjs/asm-types.h" 14 #include "src/asmjs/asm-types.h"
15 #include "src/ast/ast.h" 15 #include "src/ast/ast.h"
16 #include "src/ast/scopes.h" 16 #include "src/ast/scopes.h"
17 #include "src/base/bits.h" 17 #include "src/base/bits.h"
18 #include "src/codegen.h" 18 #include "src/codegen.h"
19 #include "src/globals.h" 19 #include "src/globals.h"
20 #include "src/messages.h"
20 #include "src/utils.h" 21 #include "src/utils.h"
21 22
22 #define FAIL(node, msg) \ 23 #define FAIL(node, msg) \
23 do { \ 24 do { \
24 int line = node->position() == kNoSourcePosition \ 25 MessageLocation location(handle(script_), node->position(), \
25 ? -1 \ 26 node->position()); \
26 : script_->GetLineNumber(node->position()); \ 27 Handle<String> message(isolate_->factory()->InternalizeOneByteString( \
27 base::OS::SNPrintF(error_message_, sizeof(error_message_), \ 28 STATIC_CHAR_VECTOR(msg))); \
28 "asm: line %d: %s", line + 1, msg); \ 29 error_message_ = MessageHandler::MakeMessageObject( \
29 return AsmType::None(); \ 30 isolate_, MessageTemplate::kAsmJsInvalid, &location, message, \
31 Handle<JSArray>::null()); \
32 return AsmType::None(); \
30 } while (false) 33 } while (false)
31 34
32 #define RECURSE(call) \ 35 #define RECURSE(call) \
33 do { \ 36 do { \
34 if (GetCurrentStackPosition() < stack_limit_) { \ 37 if (GetCurrentStackPosition() < stack_limit_) { \
35 stack_overflow_ = true; \ 38 stack_overflow_ = true; \
36 FAIL(root_, "Stack overflow while parsing asm.js module."); \ 39 FAIL(root_, "Stack overflow while parsing asm.js module."); \
37 } \ 40 } \
38 \ 41 \
39 AsmType* result = (call); \ 42 AsmType* result = (call); \
(...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 2844
2842 if (!heap_var_info->IsHeap()) { 2845 if (!heap_var_info->IsHeap()) {
2843 FAIL(heap, 2846 FAIL(heap,
2844 "Heap view creation parameter should be the module's heap parameter."); 2847 "Heap view creation parameter should be the module's heap parameter.");
2845 } 2848 }
2846 2849
2847 DCHECK(heap_view_info->type()->IsA(AsmType::Heap())); 2850 DCHECK(heap_view_info->type()->IsA(AsmType::Heap()));
2848 return heap_view_info->type(); 2851 return heap_view_info->type();
2849 } 2852 }
2850 2853
2851 bool IsValidAsm(Isolate* isolate, Zone* zone, Script* script,
2852 FunctionLiteral* root, std::string* error_message) {
2853 error_message->clear();
2854
2855 AsmTyper typer(isolate, zone, script, root);
2856 if (typer.Validate()) {
2857 return true;
2858 }
2859
2860 *error_message = typer.error_message();
2861 return false;
2862 }
2863
2864 } // namespace wasm 2854 } // namespace wasm
2865 } // namespace internal 2855 } // namespace internal
2866 } // namespace v8 2856 } // namespace v8
OLDNEW
« include/v8.h ('K') | « src/asmjs/asm-typer.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698