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

Side by Side Diff: src/wasm/wasm-interpreter.h

Issue 2639353002: [wasm] Fix I32ReinterpretF32 and I64ReinterpretF64 on ia32. (Closed)
Patch Set: Created 3 years, 11 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
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 #ifndef V8_WASM_INTERPRETER_H_ 5 #ifndef V8_WASM_INTERPRETER_H_
6 #define V8_WASM_INTERPRETER_H_ 6 #define V8_WASM_INTERPRETER_H_
7 7
8 #include "src/wasm/wasm-opcodes.h" 8 #include "src/wasm/wasm-opcodes.h"
9 #include "src/zone/zone-containers.h" 9 #include "src/zone/zone-containers.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } val; 49 } val;
50 50
51 WasmVal() : type(kWasmStmt) {} 51 WasmVal() : type(kWasmStmt) {}
52 52
53 #define DECLARE_CONSTRUCTOR(field, localtype, ctype) \ 53 #define DECLARE_CONSTRUCTOR(field, localtype, ctype) \
54 explicit WasmVal(ctype v) : type(localtype) { val.field = v; } 54 explicit WasmVal(ctype v) : type(localtype) { val.field = v; }
55 FOREACH_UNION_MEMBER(DECLARE_CONSTRUCTOR) 55 FOREACH_UNION_MEMBER(DECLARE_CONSTRUCTOR)
56 #undef DECLARE_CONSTRUCTOR 56 #undef DECLARE_CONSTRUCTOR
57 57
58 template <typename T> 58 template <typename T>
59 T to() { 59 inline T to() {
60 UNREACHABLE();
61 }
62
63 template <typename T>
64 inline T to_unchecked() {
60 UNREACHABLE(); 65 UNREACHABLE();
61 } 66 }
62 }; 67 };
63 68
64 #define DECLARE_CAST(field, localtype, ctype) \ 69 #define DECLARE_CAST(field, localtype, ctype) \
65 template <> \ 70 template <> \
71 inline ctype WasmVal::to_unchecked() { \
72 return val.field; \
73 } \
74 template <> \
66 inline ctype WasmVal::to() { \ 75 inline ctype WasmVal::to() { \
67 CHECK_EQ(localtype, type); \ 76 CHECK_EQ(localtype, type); \
68 return val.field; \ 77 return val.field; \
69 } 78 }
70 FOREACH_UNION_MEMBER(DECLARE_CAST) 79 FOREACH_UNION_MEMBER(DECLARE_CAST)
71 #undef DECLARE_CAST 80 #undef DECLARE_CAST
72 81
73 template <>
74 inline void WasmVal::to() {
75 CHECK_EQ(kWasmStmt, type);
76 }
77
78 // Representation of frames within the interpreter. 82 // Representation of frames within the interpreter.
79 class WasmFrame { 83 class WasmFrame {
80 public: 84 public:
81 const WasmFunction* function() const { return function_; } 85 const WasmFunction* function() const { return function_; }
82 int pc() const { return pc_; } 86 int pc() const { return pc_; }
83 87
84 private: 88 private:
85 friend class WasmInterpreter; 89 friend class WasmInterpreter;
86 90
87 WasmFrame(const WasmFunction* function, int pc, int fp, int sp) 91 WasmFrame(const WasmFunction* function, int pc, int fp, int sp)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 private: 198 private:
195 Zone zone_; 199 Zone zone_;
196 WasmInterpreterInternals* internals_; 200 WasmInterpreterInternals* internals_;
197 }; 201 };
198 202
199 } // namespace wasm 203 } // namespace wasm
200 } // namespace internal 204 } // namespace internal
201 } // namespace v8 205 } // namespace v8
202 206
203 #endif // V8_WASM_INTERPRETER_H_ 207 #endif // V8_WASM_INTERPRETER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698