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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10883063: Add explicit smi checks for unary smi operations. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language_ia32.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 1925
1926 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpComp); 1926 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpComp);
1927 }; 1927 };
1928 1928
1929 1929
1930 // Handles both Smi operations: BIT_OR and NEGATE. 1930 // Handles both Smi operations: BIT_OR and NEGATE.
1931 class UnarySmiOpComp : public TemplateComputation<1> { 1931 class UnarySmiOpComp : public TemplateComputation<1> {
1932 public: 1932 public:
1933 UnarySmiOpComp(Token::Kind op_kind, 1933 UnarySmiOpComp(Token::Kind op_kind,
1934 InstanceCallComp* instance_call, 1934 InstanceCallComp* instance_call,
1935 Value* value) 1935 Value* value)
1936 : op_kind_(op_kind), instance_call_(instance_call) { 1936 : op_kind_(op_kind), instance_call_(instance_call) {
1937 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT));
1937 ASSERT(value != NULL); 1938 ASSERT(value != NULL);
1938 inputs_[0] = value; 1939 inputs_[0] = value;
1939 } 1940 }
1940 1941
1941 Value* value() const { return inputs_[0]; } 1942 Value* value() const { return inputs_[0]; }
1942 Token::Kind op_kind() const { return op_kind_; } 1943 Token::Kind op_kind() const { return op_kind_; }
1943 1944
1944 InstanceCallComp* instance_call() const { return instance_call_; } 1945 InstanceCallComp* instance_call() const { return instance_call_; }
1945 1946
1946 virtual void PrintOperandsTo(BufferFormatter* f) const; 1947 virtual void PrintOperandsTo(BufferFormatter* f) const;
1947 1948
1948 DECLARE_COMPUTATION(UnarySmiOp) 1949 DECLARE_COMPUTATION(UnarySmiOp)
1949 1950
1950 virtual bool CanDeoptimize() const { return true; } 1951 virtual bool CanDeoptimize() const { return op_kind() == Token::kNEGATE; }
1951 virtual intptr_t ResultCid() const { return kSmiCid; } 1952 virtual intptr_t ResultCid() const { return kSmiCid; }
1952 1953
1953 private: 1954 private:
1954 const Token::Kind op_kind_; 1955 const Token::Kind op_kind_;
1955 InstanceCallComp* instance_call_; 1956 InstanceCallComp* instance_call_;
1956 1957
1957 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpComp); 1958 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpComp);
1958 }; 1959 };
1959 1960
1960 1961
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
3389 ForwardInstructionIterator* current_iterator_; 3390 ForwardInstructionIterator* current_iterator_;
3390 3391
3391 private: 3392 private:
3392 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3393 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3393 }; 3394 };
3394 3395
3395 3396
3396 } // namespace dart 3397 } // namespace dart
3397 3398
3398 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3399 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698