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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 9668045: MIPS: Port Date-related changes. (Closed)
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
« no previous file with comments | « no previous file | src/mips/lithium-codegen-mips.cc » ('j') | src/mips/lithium-mips.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 __ GetObjectType(v0, a1, a1); 2963 __ GetObjectType(v0, a1, a1);
2964 __ Branch(&done, ne, a1, Operand(JS_VALUE_TYPE)); 2964 __ Branch(&done, ne, a1, Operand(JS_VALUE_TYPE));
2965 2965
2966 __ lw(v0, FieldMemOperand(v0, JSValue::kValueOffset)); 2966 __ lw(v0, FieldMemOperand(v0, JSValue::kValueOffset));
2967 2967
2968 __ bind(&done); 2968 __ bind(&done);
2969 context()->Plug(v0); 2969 context()->Plug(v0);
2970 } 2970 }
2971 2971
2972 2972
2973 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
2974 ZoneList<Expression*>* args = expr->arguments();
2975 ASSERT(args->length() == 2);
2976 ASSERT_NE(NULL, args->at(1)->AsLiteral());
2977 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
2978
2979 VisitForAccumulatorValue(args->at(0)); // Load the object.
2980
2981 Label runtime, done;
2982 Register object = v0;
2983 Register result = v0;
2984 Register scratch0 = t5;
2985 Register scratch1 = a1;
2986
2987 #ifdef DEBUG
2988 __ AbortIfSmi(object);
2989 __ GetObjectType(object, scratch1, scratch1);
2990 __ Assert(eq, "Trying to get date field from non-date.",
2991 scratch1, Operand(JS_DATE_TYPE));
2992 #endif
2993
2994 if (index->value() == 0) {
2995 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset));
2996 } else {
2997 if (index->value() < JSDate::kFirstUncachedField) {
2998 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
2999 __ li(scratch1, Operand(stamp));
3000 __ lw(scratch1, MemOperand(scratch1));
3001 __ lw(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
3002 __ Branch(&runtime, ne, scratch1, Operand(scratch0));
3003 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset +
3004 kPointerSize * index->value()));
3005 __ jmp(&done);
3006 }
3007 __ bind(&runtime);
3008 __ PrepareCallCFunction(2, scratch1);
3009 __ li(a1, Operand(index));
3010 __ Move(a0, object);
3011 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3012 __ bind(&done);
3013 }
3014
3015 context()->Plug(v0);
3016 }
3017
3018
2973 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { 3019 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
2974 // Load the arguments on the stack and call the runtime function. 3020 // Load the arguments on the stack and call the runtime function.
2975 ZoneList<Expression*>* args = expr->arguments(); 3021 ZoneList<Expression*>* args = expr->arguments();
2976 ASSERT(args->length() == 2); 3022 ASSERT(args->length() == 2);
2977 VisitForStackValue(args->at(0)); 3023 VisitForStackValue(args->at(0));
2978 VisitForStackValue(args->at(1)); 3024 VisitForStackValue(args->at(1));
2979 if (CpuFeatures::IsSupported(FPU)) { 3025 if (CpuFeatures::IsSupported(FPU)) {
2980 MathPowStub stub(MathPowStub::ON_STACK); 3026 MathPowStub stub(MathPowStub::ON_STACK);
2981 __ CallStub(&stub); 3027 __ CallStub(&stub);
2982 } else { 3028 } else {
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4444 *context_length = 0; 4490 *context_length = 0;
4445 return previous_; 4491 return previous_;
4446 } 4492 }
4447 4493
4448 4494
4449 #undef __ 4495 #undef __
4450 4496
4451 } } // namespace v8::internal 4497 } } // namespace v8::internal
4452 4498
4453 #endif // V8_TARGET_ARCH_MIPS 4499 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-codegen-mips.cc » ('j') | src/mips/lithium-mips.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698