Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2073 // Build argument array to pass to the interpolation function. | 2073 // Build argument array to pass to the interpolation function. |
| 2074 GrowableArray<const Object*> interpolate_arg; | 2074 GrowableArray<const Object*> interpolate_arg; |
| 2075 interpolate_arg.Add(&literals); | 2075 interpolate_arg.Add(&literals); |
| 2076 const Array& kNoArgumentNames = Array::Handle(); | 2076 const Array& kNoArgumentNames = Array::Handle(); |
| 2077 // Call the interpolation function. | 2077 // Call the interpolation function. |
| 2078 String& concatenated = String::ZoneHandle(); | 2078 String& concatenated = String::ZoneHandle(); |
| 2079 concatenated ^= DartEntry::InvokeStatic(interpol_func, | 2079 concatenated ^= DartEntry::InvokeStatic(interpol_func, |
| 2080 interpolate_arg, | 2080 interpolate_arg, |
| 2081 kNoArgumentNames); | 2081 kNoArgumentNames); |
| 2082 if (concatenated.IsUnhandledException()) { | 2082 if (concatenated.IsUnhandledException()) { |
| 2083 // TODO(hausner): Shouldn't we generate a throw? | |
| 2084 // Then remove unused CodeGenerator::ErrorMsg(). | |
| 2083 ErrorMsg(node->token_index(), | 2085 ErrorMsg(node->token_index(), |
| 2084 "Exception thrown in CodeGenerator::VisitStringConcatNode"); | 2086 "Exception thrown in CodeGenerator::VisitStringConcatNode"); |
| 2085 } | 2087 } |
| 2086 ASSERT(!concatenated.IsNull()); | 2088 ASSERT(!concatenated.IsNull()); |
| 2087 concatenated = String::NewSymbol(concatenated); | 2089 concatenated = String::NewSymbol(concatenated); |
| 2088 | 2090 |
| 2089 __ LoadObject(EAX, concatenated); | 2091 __ LoadObject(EAX, concatenated); |
| 2090 __ pushl(EAX); | 2092 __ pushl(EAX); |
| 2091 return; | 2093 return; |
| 2092 } | 2094 } |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2437 } | 2439 } |
| 2438 | 2440 |
| 2439 | 2441 |
| 2440 // Return result in EAX. | 2442 // Return result in EAX. |
| 2441 void CodeGenerator::GenerateStaticGetterCall(intptr_t token_index, | 2443 void CodeGenerator::GenerateStaticGetterCall(intptr_t token_index, |
| 2442 const Class& field_class, | 2444 const Class& field_class, |
| 2443 const String& field_name) { | 2445 const String& field_name) { |
| 2444 const String& getter_name = String::Handle(Field::GetterName(field_name)); | 2446 const String& getter_name = String::Handle(Field::GetterName(field_name)); |
| 2445 const Function& function = | 2447 const Function& function = |
| 2446 Function::ZoneHandle(field_class.LookupStaticFunction(getter_name)); | 2448 Function::ZoneHandle(field_class.LookupStaticFunction(getter_name)); |
| 2447 if (function.IsNull()) { | 2449 ASSERT(!function.IsNull()); |
|
srdjan
2012/03/19 22:03:53
Why not a compile time error?
regis
2012/03/19 22:54:28
Giving an error from the code generator does not s
| |
| 2448 ErrorMsg(token_index, "Static getter does not exist: %s", | |
| 2449 getter_name.ToCString()); | |
| 2450 } | |
| 2451 __ LoadObject(ECX, function); | 2450 __ LoadObject(ECX, function); |
| 2452 const int kNumberOfArguments = 0; | 2451 const int kNumberOfArguments = 0; |
| 2453 const Array& kNoArgumentNames = Array::Handle(); | 2452 const Array& kNoArgumentNames = Array::Handle(); |
| 2454 __ LoadObject(EDX, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames)); | 2453 __ LoadObject(EDX, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames)); |
| 2455 GenerateCall(token_index, | 2454 GenerateCall(token_index, |
| 2456 &StubCode::CallStaticFunctionLabel(), | 2455 &StubCode::CallStaticFunctionLabel(), |
| 2457 PcDescriptors::kFuncCall); | 2456 PcDescriptors::kFuncCall); |
| 2458 // No arguments were pushed, hence nothing to pop. | 2457 // No arguments were pushed, hence nothing to pop. |
| 2459 } | 2458 } |
| 2460 | 2459 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2471 } | 2470 } |
| 2472 | 2471 |
| 2473 | 2472 |
| 2474 // Expects value on stack. | 2473 // Expects value on stack. |
| 2475 void CodeGenerator::GenerateStaticSetterCall(intptr_t token_index, | 2474 void CodeGenerator::GenerateStaticSetterCall(intptr_t token_index, |
| 2476 const Class& field_class, | 2475 const Class& field_class, |
| 2477 const String& field_name) { | 2476 const String& field_name) { |
| 2478 const String& setter_name = String::Handle(Field::SetterName(field_name)); | 2477 const String& setter_name = String::Handle(Field::SetterName(field_name)); |
| 2479 const Function& function = | 2478 const Function& function = |
| 2480 Function::ZoneHandle(field_class.LookupStaticFunction(setter_name)); | 2479 Function::ZoneHandle(field_class.LookupStaticFunction(setter_name)); |
| 2480 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
| |
| 2481 __ LoadObject(ECX, function); | 2481 __ LoadObject(ECX, function); |
| 2482 const int kNumberOfArguments = 1; // value. | 2482 const int kNumberOfArguments = 1; // value. |
| 2483 const Array& kNoArgumentNames = Array::Handle(); | 2483 const Array& kNoArgumentNames = Array::Handle(); |
| 2484 __ LoadObject(EDX, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames)); | 2484 __ LoadObject(EDX, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames)); |
| 2485 GenerateCall(token_index, | 2485 GenerateCall(token_index, |
| 2486 &StubCode::CallStaticFunctionLabel(), | 2486 &StubCode::CallStaticFunctionLabel(), |
| 2487 PcDescriptors::kFuncCall); | 2487 PcDescriptors::kFuncCall); |
| 2488 __ addl(ESP, Immediate(kNumberOfArguments * kWordSize)); | 2488 __ addl(ESP, Immediate(kNumberOfArguments * kWordSize)); |
| 2489 } | 2489 } |
| 2490 | 2490 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2682 const Error& error = Error::Handle( | 2682 const Error& error = Error::Handle( |
| 2683 Parser::FormatError(script, token_index, "Error", format, args)); | 2683 Parser::FormatError(script, token_index, "Error", format, args)); |
| 2684 va_end(args); | 2684 va_end(args); |
| 2685 Isolate::Current()->long_jump_base()->Jump(1, error); | 2685 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 2686 UNREACHABLE(); | 2686 UNREACHABLE(); |
| 2687 } | 2687 } |
| 2688 | 2688 |
| 2689 } // namespace dart | 2689 } // namespace dart |
| 2690 | 2690 |
| 2691 #endif // defined TARGET_ARCH_IA32 | 2691 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |