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

Side by Side Diff: src/signature.h

Issue 2102193003: Revert "Revert "[wasm] Complete separation of compilation and instantiation"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Some DCHECKs Created 4 years, 5 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
« no previous file with comments | « src/runtime/runtime-wasm.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_SIGNATURE_H_ 5 #ifndef V8_SIGNATURE_H_
6 #define V8_SIGNATURE_H_ 6 #define V8_SIGNATURE_H_
7 7
8 #include "src/zone.h" 8 #include "src/zone.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // Describes the inputs and outputs of a function or call. 13 // Describes the inputs and outputs of a function or call.
14 template <typename T> 14 template <typename T>
15 class Signature : public ZoneObject { 15 class Signature : public ZoneObject {
16 public: 16 public:
17 Signature(size_t return_count, size_t parameter_count, T* reps) 17 Signature(size_t return_count, size_t parameter_count, const T* reps)
18 : return_count_(return_count), 18 : return_count_(return_count),
19 parameter_count_(parameter_count), 19 parameter_count_(parameter_count),
20 reps_(reps) {} 20 reps_(reps) {}
21 21
22 size_t return_count() const { return return_count_; } 22 size_t return_count() const { return return_count_; }
23 size_t parameter_count() const { return parameter_count_; } 23 size_t parameter_count() const { return parameter_count_; }
24 24
25 T GetParam(size_t index) const { 25 T GetParam(size_t index) const {
26 DCHECK(index < parameter_count_); 26 DCHECK(index < parameter_count_);
27 return reps_[return_count_ + index]; 27 return reps_[return_count_ + index];
28 } 28 }
29 29
30 T GetReturn(size_t index = 0) const { 30 T GetReturn(size_t index = 0) const {
31 DCHECK(index < return_count_); 31 DCHECK(index < return_count_);
32 return reps_[index]; 32 return reps_[index];
33 } 33 }
34 34
35 const T* raw_data() const { return reps_; }
36
35 // For incrementally building signatures. 37 // For incrementally building signatures.
36 class Builder { 38 class Builder {
37 public: 39 public:
38 Builder(Zone* zone, size_t return_count, size_t parameter_count) 40 Builder(Zone* zone, size_t return_count, size_t parameter_count)
39 : return_count_(return_count), 41 : return_count_(return_count),
40 parameter_count_(parameter_count), 42 parameter_count_(parameter_count),
41 zone_(zone), 43 zone_(zone),
42 rcursor_(0), 44 rcursor_(0),
43 pcursor_(0), 45 pcursor_(0),
44 buffer_(zone->NewArray<T>( 46 buffer_(zone->NewArray<T>(
(...skipping 19 matching lines...) Expand all
64 private: 66 private:
65 Zone* zone_; 67 Zone* zone_;
66 size_t rcursor_; 68 size_t rcursor_;
67 size_t pcursor_; 69 size_t pcursor_;
68 T* buffer_; 70 T* buffer_;
69 }; 71 };
70 72
71 protected: 73 protected:
72 size_t return_count_; 74 size_t return_count_;
73 size_t parameter_count_; 75 size_t parameter_count_;
74 T* reps_; 76 const T* reps_;
75 }; 77 };
76 78
77 } // namespace internal 79 } // namespace internal
78 } // namespace v8 80 } // namespace v8
79 81
80 #endif // V8_SIGNATURE_H_ 82 #endif // V8_SIGNATURE_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-wasm.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698