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

Side by Side Diff: runtime/vm/code_generator_ia32.cc

Issue 10659005: Implement type cast in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
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 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 __ Bind(&done); 1872 __ Bind(&done);
1873 } 1873 }
1874 1874
1875 1875
1876 void CodeGenerator::VisitComparisonNode(ComparisonNode* node) { 1876 void CodeGenerator::VisitComparisonNode(ComparisonNode* node) {
1877 const Bool& bool_true = Bool::ZoneHandle(Bool::True()); 1877 const Bool& bool_true = Bool::ZoneHandle(Bool::True());
1878 const Bool& bool_false = Bool::ZoneHandle(Bool::False()); 1878 const Bool& bool_false = Bool::ZoneHandle(Bool::False());
1879 node->left()->Visit(this); 1879 node->left()->Visit(this);
1880 1880
1881 // The instanceof operator needs special handling. 1881 // The instanceof operator needs special handling.
1882 if (Token::IsInstanceofOperator(node->kind())) { 1882 if (Token::IsTypeTestOperator(node->kind())) {
1883 __ popl(EAX); // Left operand. 1883 __ popl(EAX); // Left operand.
1884 ASSERT(node->right()->IsTypeNode()); 1884 ASSERT(node->right()->IsTypeNode());
1885 GenerateInstanceOf(node->id(), 1885 GenerateInstanceOf(node->id(),
1886 node->token_pos(), 1886 node->token_pos(),
1887 node->left(), 1887 node->left(),
1888 node->right()->AsTypeNode()->type(), 1888 node->right()->AsTypeNode()->type(),
1889 (node->kind() == Token::kISNOT)); 1889 (node->kind() == Token::kISNOT));
1890 if (!IsResultNeeded(node)) { 1890 if (!IsResultNeeded(node)) {
1891 __ popl(EAX); // Pop the result of the instanceof operation. 1891 __ popl(EAX); // Pop the result of the instanceof operation.
1892 } 1892 }
1893 return; 1893 return;
1894 } 1894 }
1895 1895
1896 if (Token::IsTypeCastOperator(node->kind())) {
1897 // This code generator is not maintained anymore.
1898 UNIMPLEMENTED();
1899 }
1900
1896 node->right()->Visit(this); 1901 node->right()->Visit(this);
1897 // Both left and right values on stack. 1902 // Both left and right values on stack.
1898 1903
1899 // '===' and '!==' are not overloadable. 1904 // '===' and '!==' are not overloadable.
1900 if ((node->kind() == Token::kEQ_STRICT) || 1905 if ((node->kind() == Token::kEQ_STRICT) ||
1901 (node->kind() == Token::kNE_STRICT)) { 1906 (node->kind() == Token::kNE_STRICT)) {
1902 __ popl(EDX); // Right operand. 1907 __ popl(EDX); // Right operand.
1903 __ popl(EAX); // Left operand. 1908 __ popl(EAX); // Left operand.
1904 if (!IsResultNeeded(node)) { 1909 if (!IsResultNeeded(node)) {
1905 return; 1910 return;
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2965 const Error& error = Error::Handle( 2970 const Error& error = Error::Handle(
2966 Parser::FormatError(script, token_pos, "Error", format, args)); 2971 Parser::FormatError(script, token_pos, "Error", format, args));
2967 va_end(args); 2972 va_end(args);
2968 Isolate::Current()->long_jump_base()->Jump(1, error); 2973 Isolate::Current()->long_jump_base()->Jump(1, error);
2969 UNREACHABLE(); 2974 UNREACHABLE();
2970 } 2975 }
2971 2976
2972 } // namespace dart 2977 } // namespace dart
2973 2978
2974 #endif // defined TARGET_ARCH_IA32 2979 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/ast.cc ('k') | runtime/vm/exceptions.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698