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

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

Issue 14069019: Implements context allocation stub for MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/custom_isolate_test.cc ('k') | runtime/vm/intermediate_language_mips.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // If type checks are not eliminated during the graph building then 355 // If type checks are not eliminated during the graph building then
356 // a transition sentinel can be seen here. 356 // a transition sentinel can be seen here.
357 __ BranchEqual(A0, Object::transition_sentinel(), &is_assignable); 357 __ BranchEqual(A0, Object::transition_sentinel(), &is_assignable);
358 } 358 }
359 359
360 // Generate throw new TypeError() if the type is malformed. 360 // Generate throw new TypeError() if the type is malformed.
361 if (dst_type.IsMalformed()) { 361 if (dst_type.IsMalformed()) {
362 const Error& error = Error::Handle(dst_type.malformed_error()); 362 const Error& error = Error::Handle(dst_type.malformed_error());
363 const String& error_message = String::ZoneHandle( 363 const String& error_message = String::ZoneHandle(
364 Symbols::New(error.ToErrorCString())); 364 Symbols::New(error.ToErrorCString()));
365 __ PushObject(Object::ZoneHandle()); // Make room for the result. 365
366 __ Push(A0); // Push the source object. 366 __ addiu(SP, SP, Immediate(-4 * kWordSize));
367 __ PushObject(dst_name); // Push the name of the destination. 367 __ LoadObject(TMP1, Object::ZoneHandle());
368 __ PushObject(error_message); 368 __ sw(TMP1, Address(SP, 3 * kWordSize)); // Make room for the result.
369 __ sw(A0, Address(SP, 2 * kWordSize)); // Push the source object.
370 __ LoadObject(TMP1, dst_name);
371 __ sw(TMP1, Address(SP, 1 * kWordSize)); // Push the destination name.
372 __ LoadObject(TMP1, error_message);
373 __ sw(TMP1, Address(SP, 0 * kWordSize));
374
369 GenerateCallRuntime(token_pos, 375 GenerateCallRuntime(token_pos,
370 deopt_id, 376 deopt_id,
371 kMalformedTypeErrorRuntimeEntry, 377 kMalformedTypeErrorRuntimeEntry,
372 locs); 378 locs);
373 // We should never return here. 379 // We should never return here.
374 __ break_(0); 380 __ break_(0);
375 381
376 __ Bind(&is_assignable); // For a null object. 382 __ Bind(&is_assignable); // For a null object.
377 // Restore instantiator and its type arguments. 383 // Restore instantiator and its type arguments.
378 __ lw(A1, Address(SP, 0 * kWordSize)); 384 __ lw(A1, Address(SP, 0 * kWordSize));
379 __ lw(A2, Address(SP, 1 * kWordSize)); 385 __ lw(A2, Address(SP, 1 * kWordSize));
380 __ addiu(SP, SP, Immediate(2 * kWordSize)); 386 __ addiu(SP, SP, Immediate(2 * kWordSize));
381 return; 387 return;
382 } 388 }
383 389
384 // Generate inline type check, linking to runtime call if not assignable. 390 // Generate inline type check, linking to runtime call if not assignable.
385 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); 391 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle();
386 test_cache = GenerateInlineInstanceof(token_pos, dst_type, 392 test_cache = GenerateInlineInstanceof(token_pos, dst_type,
387 &is_assignable, &runtime_call); 393 &is_assignable, &runtime_call);
388 394
389 __ Bind(&runtime_call); 395 __ Bind(&runtime_call);
390 // Load instantiator and its type arguments. 396 // Load instantiator and its type arguments.
391 __ lw(A1, Address(SP, 0 * kWordSize)); 397 __ lw(A1, Address(SP, 0 * kWordSize));
392 __ lw(A2, Address(SP, 1 * kWordSize)); 398 __ lw(A2, Address(SP, 1 * kWordSize));
393 __ PushObject(Object::ZoneHandle()); // Make room for the result. 399
394 __ Push(A0); // Push the source object. 400 __ addiu(SP, SP, Immediate(-7 * kWordSize));
395 __ PushObject(dst_type); // Push the type of the destination. 401 __ LoadObject(TMP1, Object::ZoneHandle());
396 // Push instantiator and its type arguments. 402 __ sw(TMP1, Address(SP, 6 * kWordSize)); // Make room for the result.
397 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 403 __ sw(A0, Address(SP, 5 * kWordSize)); // Push the source object.
398 __ sw(A2, Address(SP, 1 * kWordSize)); 404 __ LoadObject(TMP1, dst_type);
399 __ sw(A1, Address(SP, 0 * kWordSize)); 405 __ sw(TMP1, Address(SP, 4 * kWordSize)); // Push the type of the destination.
400 __ PushObject(dst_name); // Push the name of the destination. 406 __ sw(A2, Address(SP, 3 * kWordSize)); // Push instantiator.
401 __ LoadObject(T0, test_cache); 407 __ sw(A1, Address(SP, 2 * kWordSize)); // Push type arguments.
402 __ Push(T0); 408 __ LoadObject(TMP1, dst_name);
409 __ sw(TMP1, Address(SP, 1 * kWordSize)); // Push the name of the destination.
410 __ sw(T0, Address(SP, 0 * kWordSize));
411
403 GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs); 412 GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs);
404 // Pop the parameters supplied to the runtime entry. The result of the 413 // Pop the parameters supplied to the runtime entry. The result of the
405 // type check runtime call is the checked value. 414 // type check runtime call is the checked value.
406 __ Drop(6); 415 __ lw(A0, Address(SP, 6 * kWordSize));
407 __ Pop(A0); 416 __ addiu(SP, SP, Immediate(7 * kWordSize));
408 417
409 __ Bind(&is_assignable); 418 __ Bind(&is_assignable);
410 // Restore instantiator and its type arguments. 419 // Restore instantiator and its type arguments.
411 __ lw(A1, Address(SP, 0 * kWordSize)); 420 __ lw(A1, Address(SP, 0 * kWordSize));
412 __ lw(A2, Address(SP, 1 * kWordSize)); 421 __ lw(A2, Address(SP, 1 * kWordSize));
413 __ addiu(SP, SP, Immediate(2 * kWordSize)); 422 __ addiu(SP, SP, Immediate(2 * kWordSize));
414 } 423 }
415 424
416 425
417 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { 426 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) {
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 bool needs_number_check) { 1057 bool needs_number_check) {
1049 UNIMPLEMENTED(); 1058 UNIMPLEMENTED();
1050 } 1059 }
1051 1060
1052 1061
1053 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, 1062 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left,
1054 Register right, 1063 Register right,
1055 bool needs_number_check) { 1064 bool needs_number_check) {
1056 __ TraceSimMsg("EqualityRegRegCompare"); 1065 __ TraceSimMsg("EqualityRegRegCompare");
1057 if (needs_number_check) { 1066 if (needs_number_check) {
1058 __ Push(left); 1067 __ addiu(SP, SP, Immediate(-2 * kWordSize));
1059 __ Push(right); 1068 __ sw(left, Address(SP, 1 * kWordSize));
1069 __ sw(right, Address(SP, 0 * kWordSize));
1060 __ BranchLink(&StubCode::IdenticalWithNumberCheckLabel()); 1070 __ BranchLink(&StubCode::IdenticalWithNumberCheckLabel());
1071 __ TraceSimMsg("EqualityRegRegCompare return");
1061 // Stub returns result in CMPRES. If it is 0, then left and right are equal. 1072 // Stub returns result in CMPRES. If it is 0, then left and right are equal.
1062 __ Pop(right); 1073 __ lw(right, Address(SP, 0 * kWordSize));
1063 __ Pop(left); 1074 __ lw(left, Address(SP, 1 * kWordSize));
1075 __ addiu(SP, SP, Immediate(2 * kWordSize));
1064 } else { 1076 } else {
1065 __ subu(CMPRES, left, right); 1077 __ subu(CMPRES, left, right);
1066 } 1078 }
1067 } 1079 }
1068 1080
1069 1081
1070 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result, 1082 void FlowGraphCompiler::EmitSuperEqualityCallPrologue(Register result,
1071 Label* skip_call) { 1083 Label* skip_call) {
1072 UNIMPLEMENTED(); 1084 UNIMPLEMENTED();
1073 } 1085 }
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 __ AddImmediate(SP, kDoubleSize); 1409 __ AddImmediate(SP, kDoubleSize);
1398 } 1410 }
1399 1411
1400 1412
1401 #undef __ 1413 #undef __
1402 1414
1403 1415
1404 } // namespace dart 1416 } // namespace dart
1405 1417
1406 #endif // defined TARGET_ARCH_MIPS 1418 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/custom_isolate_test.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698