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

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

Issue 1494323002: Revert "Precompilation/x64: Load float vector constants via Thread." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | « runtime/vm/thread.cc ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_UNIT_TEST_H_ 5 #ifndef VM_UNIT_TEST_H_
6 #define VM_UNIT_TEST_H_ 6 #define VM_UNIT_TEST_H_
7 7
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/globals.h" 10 #include "platform/globals.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 ASSERT(assembler != NULL); 353 ASSERT(assembler != NULL);
354 } 354 }
355 ~AssemblerTest() { } 355 ~AssemblerTest() { }
356 356
357 Assembler* assembler() const { return assembler_; } 357 Assembler* assembler() const { return assembler_; }
358 358
359 const Code& code() const { return code_; } 359 const Code& code() const { return code_; }
360 360
361 uword entry() const { return code_.EntryPoint(); } 361 uword entry() const { return code_.EntryPoint(); }
362 362
363 // Invoke/InvokeWithCodeAndThread is used to call assembler test functions 363 // Invoke/InvokeWithCode is used to call assembler test functions using the
364 // using the ABI calling convention. 364 // ABI calling convention.
365 // ResultType is the return type of the assembler test function. 365 // ResultType is the return type of the assembler test function.
366 // ArgNType is the type of the Nth argument. 366 // ArgNType is the type of the Nth argument.
367 #if defined(USING_SIMULATOR) 367 #if defined(USING_SIMULATOR)
368 368
369 #if defined(ARCH_IS_64_BIT) 369 #if defined(ARCH_IS_64_BIT)
370 // TODO(fschneider): Make InvokeWithCodeAndThread<> more general and work on 370 // TODO(fschneider): Make InvokeWithCode<> more general and work on 32-bit.
371 // 32-bit.
372 // Since Simulator::Call always return a int64_t, bit_cast does not work 371 // Since Simulator::Call always return a int64_t, bit_cast does not work
373 // on 32-bit platforms when returning an int32_t. Since template functions 372 // on 32-bit platforms when returning an int32_t. Since template functions
374 // don't support partial specialization, we'd need to introduce a helper 373 // don't support partial specialization, we'd need to introduce a helper
375 // class to support 32-bit return types. 374 // class to support 32-bit return types.
376 template<typename ResultType> ResultType InvokeWithCodeAndThread() { 375 template<typename ResultType> ResultType InvokeWithCode() {
377 const bool fp_return = is_double<ResultType>::value; 376 const bool fp_return = is_double<ResultType>::value;
378 const bool fp_args = false; 377 const bool fp_args = false;
379 Thread* thread = Thread::Current();
380 ASSERT(thread != NULL);
381 return bit_cast<ResultType, int64_t>(Simulator::Current()->Call( 378 return bit_cast<ResultType, int64_t>(Simulator::Current()->Call(
382 bit_cast<intptr_t, uword>(entry()), 379 bit_cast<intptr_t, uword>(entry()),
383 reinterpret_cast<intptr_t>(&code_), 380 reinterpret_cast<intptr_t>(&code_), 0, 0, 0, fp_return, fp_args));
384 reinterpret_cast<intptr_t>(thread),
385 0, 0, fp_return, fp_args));
386 } 381 }
387 template<typename ResultType, typename Arg1Type> 382 template<typename ResultType, typename Arg1Type>
388 ResultType InvokeWithCodeAndThread(Arg1Type arg1) { 383 ResultType InvokeWithCode(Arg1Type arg1) {
389 const bool fp_return = is_double<ResultType>::value; 384 const bool fp_return = is_double<ResultType>::value;
390 const bool fp_args = is_double<Arg1Type>::value; 385 const bool fp_args = is_double<Arg1Type>::value;
391 // TODO(fschneider): Support double arguments for simulator calls. 386 // TODO(fschneider): Support double arguments for simulator calls.
392 COMPILE_ASSERT(!fp_args); 387 COMPILE_ASSERT(!fp_args);
393 Thread* thread = Thread::Current();
394 ASSERT(thread != NULL);
395 return bit_cast<ResultType, int64_t>(Simulator::Current()->Call( 388 return bit_cast<ResultType, int64_t>(Simulator::Current()->Call(
396 bit_cast<intptr_t, uword>(entry()), 389 bit_cast<intptr_t, uword>(entry()),
397 reinterpret_cast<intptr_t>(&code_), 390 reinterpret_cast<intptr_t>(&code_),
398 reinterpret_cast<intptr_t>(thread),
399 reinterpret_cast<intptr_t>(arg1), 391 reinterpret_cast<intptr_t>(arg1),
400 0, fp_return, fp_args)); 392 0, 0, fp_return, fp_args));
401 } 393 }
402 #endif // ARCH_IS_64_BIT 394 #endif // ARCH_IS_64_BIT
403 395
404 template<typename ResultType, 396 template<typename ResultType,
405 typename Arg1Type, 397 typename Arg1Type,
406 typename Arg2Type, 398 typename Arg2Type,
407 typename Arg3Type> 399 typename Arg3Type>
408 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) { 400 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) {
409 // TODO(fschneider): Support double arguments for simulator calls. 401 // TODO(fschneider): Support double arguments for simulator calls.
410 COMPILE_ASSERT(is_void<ResultType>::value); 402 COMPILE_ASSERT(is_void<ResultType>::value);
411 COMPILE_ASSERT(!is_double<Arg1Type>::value); 403 COMPILE_ASSERT(!is_double<Arg1Type>::value);
412 COMPILE_ASSERT(!is_double<Arg2Type>::value); 404 COMPILE_ASSERT(!is_double<Arg2Type>::value);
413 COMPILE_ASSERT(!is_double<Arg3Type>::value); 405 COMPILE_ASSERT(!is_double<Arg3Type>::value);
414 const bool fp_args = false; 406 const bool fp_args = false;
415 const bool fp_return = false; 407 const bool fp_return = false;
416 Simulator::Current()->Call( 408 Simulator::Current()->Call(
417 bit_cast<intptr_t, uword>(entry()), 409 bit_cast<intptr_t, uword>(entry()),
418 reinterpret_cast<intptr_t>(arg1), 410 reinterpret_cast<intptr_t>(arg1),
419 reinterpret_cast<intptr_t>(arg2), 411 reinterpret_cast<intptr_t>(arg2),
420 reinterpret_cast<intptr_t>(arg3), 412 reinterpret_cast<intptr_t>(arg3),
421 0, fp_return, fp_args); 413 0, fp_return, fp_args);
422 } 414 }
423 #else 415 #else
424 template<typename ResultType> ResultType InvokeWithCodeAndThread() { 416 template<typename ResultType> ResultType InvokeWithCode() {
425 Thread* thread = Thread::Current(); 417 typedef ResultType (*FunctionType) (const Code&);
426 ASSERT(thread != NULL); 418 return reinterpret_cast<FunctionType>(entry())(code_);
427 typedef ResultType (*FunctionType) (const Code&, Thread*);
428 return reinterpret_cast<FunctionType>(entry())(code_, thread);
429 } 419 }
430 420
431 template<typename ResultType, typename Arg1Type> 421 template<typename ResultType, typename Arg1Type>
432 ResultType InvokeWithCodeAndThread(Arg1Type arg1) { 422 ResultType InvokeWithCode(Arg1Type arg1) {
433 Thread* thread = Thread::Current(); 423 typedef ResultType (*FunctionType) (const Code&, Arg1Type);
434 ASSERT(thread != NULL); 424 return reinterpret_cast<FunctionType>(entry())(code_, arg1);
435 typedef ResultType (*FunctionType) (const Code&, Thread*, Arg1Type);
436 return reinterpret_cast<FunctionType>(entry())(code_, thread, arg1);
437 } 425 }
438 426
439 template<typename ResultType, 427 template<typename ResultType,
440 typename Arg1Type, 428 typename Arg1Type,
441 typename Arg2Type, 429 typename Arg2Type,
442 typename Arg3Type> 430 typename Arg3Type>
443 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) { 431 ResultType Invoke(Arg1Type arg1, Arg2Type arg2, Arg3Type arg3) {
444 typedef ResultType (*FunctionType) (Arg1Type, Arg2Type, Arg3Type); 432 typedef ResultType (*FunctionType) (Arg1Type, Arg2Type, Arg3Type);
445 return reinterpret_cast<FunctionType>(entry())(arg1, arg2, arg3); 433 return reinterpret_cast<FunctionType>(entry())(arg1, arg2, arg3);
446 } 434 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 // Yields: 537 // Yields:
550 // 538 //
551 // out = "\"id\":\"\"" 539 // out = "\"id\":\"\""
552 // 540 //
553 void ElideJSONSubstring(const char* prefix, const char* in, char* out); 541 void ElideJSONSubstring(const char* prefix, const char* in, char* out);
554 542
555 543
556 } // namespace dart 544 } // namespace dart
557 545
558 #endif // VM_UNIT_TEST_H_ 546 #endif // VM_UNIT_TEST_H_
OLDNEW
« no previous file with comments | « runtime/vm/thread.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698