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

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

Issue 9726011: Implement StaticGetter and StaticSetter in new compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
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 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 // Build argument array to pass to the interpolation function. 2081 // Build argument array to pass to the interpolation function.
2082 GrowableArray<const Object*> interpolate_arg; 2082 GrowableArray<const Object*> interpolate_arg;
2083 interpolate_arg.Add(&literals); 2083 interpolate_arg.Add(&literals);
2084 const Array& kNoArgumentNames = Array::Handle(); 2084 const Array& kNoArgumentNames = Array::Handle();
2085 // Call the interpolation function. 2085 // Call the interpolation function.
2086 String& concatenated = String::ZoneHandle(); 2086 String& concatenated = String::ZoneHandle();
2087 concatenated ^= DartEntry::InvokeStatic(interpol_func, 2087 concatenated ^= DartEntry::InvokeStatic(interpol_func,
2088 interpolate_arg, 2088 interpolate_arg,
2089 kNoArgumentNames); 2089 kNoArgumentNames);
2090 if (concatenated.IsUnhandledException()) { 2090 if (concatenated.IsUnhandledException()) {
2091 // TODO(hausner): Shouldn't we generate a throw?
2092 // Then remove unused CodeGenerator::ErrorMsg().
2091 ErrorMsg(node->token_index(), 2093 ErrorMsg(node->token_index(),
2092 "Exception thrown in CodeGenerator::VisitStringConcatNode"); 2094 "Exception thrown in CodeGenerator::VisitStringConcatNode");
2093 } 2095 }
2094 ASSERT(!concatenated.IsNull()); 2096 ASSERT(!concatenated.IsNull());
2095 concatenated = String::NewSymbol(concatenated); 2097 concatenated = String::NewSymbol(concatenated);
2096 2098
2097 __ LoadObject(RAX, concatenated); 2099 __ LoadObject(RAX, concatenated);
2098 __ pushq(RAX); 2100 __ pushq(RAX);
2099 return; 2101 return;
2100 } 2102 }
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2445 } 2447 }
2446 2448
2447 2449
2448 // Return result in RAX. 2450 // Return result in RAX.
2449 void CodeGenerator::GenerateStaticGetterCall(intptr_t token_index, 2451 void CodeGenerator::GenerateStaticGetterCall(intptr_t token_index,
2450 const Class& field_class, 2452 const Class& field_class,
2451 const String& field_name) { 2453 const String& field_name) {
2452 const String& getter_name = String::Handle(Field::GetterName(field_name)); 2454 const String& getter_name = String::Handle(Field::GetterName(field_name));
2453 const Function& function = 2455 const Function& function =
2454 Function::ZoneHandle(field_class.LookupStaticFunction(getter_name)); 2456 Function::ZoneHandle(field_class.LookupStaticFunction(getter_name));
2455 if (function.IsNull()) { 2457 ASSERT(!function.IsNull());
srdjan 2012/03/19 22:03:53 Ditto
regis 2012/03/19 22:54:28 Ditto.
2456 ErrorMsg(token_index, "Static getter does not exist: %s",
2457 getter_name.ToCString());
2458 }
2459 __ LoadObject(RBX, function); 2458 __ LoadObject(RBX, function);
2460 const int kNumberOfArguments = 0; 2459 const int kNumberOfArguments = 0;
2461 const Array& kNoArgumentNames = Array::Handle(); 2460 const Array& kNoArgumentNames = Array::Handle();
2462 __ LoadObject(R10, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames)); 2461 __ LoadObject(R10, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames));
2463 GenerateCall(token_index, 2462 GenerateCall(token_index,
2464 &StubCode::CallStaticFunctionLabel(), 2463 &StubCode::CallStaticFunctionLabel(),
2465 PcDescriptors::kFuncCall); 2464 PcDescriptors::kFuncCall);
2466 // No arguments were pushed, hence nothing to pop. 2465 // No arguments were pushed, hence nothing to pop.
2467 } 2466 }
2468 2467
(...skipping 10 matching lines...) Expand all
2479 } 2478 }
2480 2479
2481 2480
2482 // Expects value on stack. 2481 // Expects value on stack.
2483 void CodeGenerator::GenerateStaticSetterCall(intptr_t token_index, 2482 void CodeGenerator::GenerateStaticSetterCall(intptr_t token_index,
2484 const Class& field_class, 2483 const Class& field_class,
2485 const String& field_name) { 2484 const String& field_name) {
2486 const String& setter_name = String::Handle(Field::SetterName(field_name)); 2485 const String& setter_name = String::Handle(Field::SetterName(field_name));
2487 const Function& function = 2486 const Function& function =
2488 Function::ZoneHandle(field_class.LookupStaticFunction(setter_name)); 2487 Function::ZoneHandle(field_class.LookupStaticFunction(setter_name));
2488 ASSERT(!function.IsNull());
srdjan 2012/03/19 22:03:53 Ditto
regis 2012/03/19 22:54:28 This case is definitely checked by the parser and
2489 __ LoadObject(RBX, function); 2489 __ LoadObject(RBX, function);
2490 const int kNumberOfArguments = 1; // value. 2490 const int kNumberOfArguments = 1; // value.
2491 const Array& kNoArgumentNames = Array::Handle(); 2491 const Array& kNoArgumentNames = Array::Handle();
2492 __ LoadObject(R10, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames)); 2492 __ LoadObject(R10, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames));
2493 GenerateCall(token_index, 2493 GenerateCall(token_index,
2494 &StubCode::CallStaticFunctionLabel(), 2494 &StubCode::CallStaticFunctionLabel(),
2495 PcDescriptors::kFuncCall); 2495 PcDescriptors::kFuncCall);
2496 __ addq(RSP, Immediate(kNumberOfArguments * kWordSize)); 2496 __ addq(RSP, Immediate(kNumberOfArguments * kWordSize));
2497 } 2497 }
2498 2498
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2690 const Error& error = Error::Handle( 2690 const Error& error = Error::Handle(
2691 Parser::FormatError(script, token_index, "Error", format, args)); 2691 Parser::FormatError(script, token_index, "Error", format, args));
2692 va_end(args); 2692 va_end(args);
2693 Isolate::Current()->long_jump_base()->Jump(1, error); 2693 Isolate::Current()->long_jump_base()->Jump(1, error);
2694 UNREACHABLE(); 2694 UNREACHABLE();
2695 } 2695 }
2696 2696
2697 } // namespace dart 2697 } // namespace dart
2698 2698
2699 #endif // defined TARGET_ARCH_X64 2699 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698