| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 | 1216 |
| 1217 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 1217 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
| 1218 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 1218 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1219 } | 1219 } |
| 1220 | 1220 |
| 1221 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1221 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1222 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1222 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 // static | 1225 // static |
| 1226 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1227 int field_index) { | |
| 1228 // ----------- S t a t e ------------- | |
| 1229 // -- eax : number of arguments | |
| 1230 // -- edi : function | |
| 1231 // -- esi : context | |
| 1232 // -- esp[0] : return address | |
| 1233 // -- esp[4] : receiver | |
| 1234 // ----------------------------------- | |
| 1235 | |
| 1236 // 1. Load receiver into eax and check that it's actually a JSDate object. | |
| 1237 Label receiver_not_date; | |
| 1238 { | |
| 1239 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1240 __ JumpIfSmi(eax, &receiver_not_date); | |
| 1241 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); | |
| 1242 __ j(not_equal, &receiver_not_date); | |
| 1243 } | |
| 1244 | |
| 1245 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1246 if (field_index == JSDate::kDateValue) { | |
| 1247 __ mov(eax, FieldOperand(eax, JSDate::kValueOffset)); | |
| 1248 } else { | |
| 1249 if (field_index < JSDate::kFirstUncachedField) { | |
| 1250 Label stamp_mismatch; | |
| 1251 __ mov(edx, Operand::StaticVariable( | |
| 1252 ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1253 __ cmp(edx, FieldOperand(eax, JSDate::kCacheStampOffset)); | |
| 1254 __ j(not_equal, &stamp_mismatch, Label::kNear); | |
| 1255 __ mov(eax, FieldOperand( | |
| 1256 eax, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1257 __ ret(1 * kPointerSize); | |
| 1258 __ bind(&stamp_mismatch); | |
| 1259 } | |
| 1260 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1261 __ PrepareCallCFunction(2, ebx); | |
| 1262 __ mov(Operand(esp, 0), eax); | |
| 1263 __ mov(Operand(esp, 1 * kPointerSize), | |
| 1264 Immediate(Smi::FromInt(field_index))); | |
| 1265 __ CallCFunction( | |
| 1266 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1267 } | |
| 1268 __ ret(1 * kPointerSize); | |
| 1269 | |
| 1270 // 3. Raise a TypeError if the receiver is not a date. | |
| 1271 __ bind(&receiver_not_date); | |
| 1272 { | |
| 1273 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1274 __ Move(ebx, Immediate(0)); | |
| 1275 __ EnterBuiltinFrame(esi, edi, ebx); | |
| 1276 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1277 | |
| 1278 // It's far from obvious, but this final trailing instruction after the call | |
| 1279 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1280 // why: if call were the final instruction in the code object, then the pc | |
| 1281 // (== return address) would point beyond the code object when the stack is | |
| 1282 // traversed. When we then try to look up the code object through | |
| 1283 // StackFrame::LookupCode, we actually return the next code object that | |
| 1284 // happens to be on the same page in memory. | |
| 1285 // TODO(jgruber): A proper fix for this would be nice. | |
| 1286 __ nop(); | |
| 1287 } | |
| 1288 } | |
| 1289 | |
| 1290 // static | |
| 1291 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1226 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1292 // ----------- S t a t e ------------- | 1227 // ----------- S t a t e ------------- |
| 1293 // -- eax : argc | 1228 // -- eax : argc |
| 1294 // -- esp[0] : return address | 1229 // -- esp[0] : return address |
| 1295 // -- esp[4] : argArray | 1230 // -- esp[4] : argArray |
| 1296 // -- esp[8] : thisArg | 1231 // -- esp[8] : thisArg |
| 1297 // -- esp[12] : receiver | 1232 // -- esp[12] : receiver |
| 1298 // ----------------------------------- | 1233 // ----------------------------------- |
| 1299 | 1234 |
| 1300 // 1. Load receiver into edi, argArray into eax (if present), remove all | 1235 // 1. Load receiver into edi, argArray into eax (if present), remove all |
| (...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 | 3000 |
| 3066 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3001 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3067 Generate_OnStackReplacementHelper(masm, true); | 3002 Generate_OnStackReplacementHelper(masm, true); |
| 3068 } | 3003 } |
| 3069 | 3004 |
| 3070 #undef __ | 3005 #undef __ |
| 3071 } // namespace internal | 3006 } // namespace internal |
| 3072 } // namespace v8 | 3007 } // namespace v8 |
| 3073 | 3008 |
| 3074 #endif // V8_TARGET_ARCH_X87 | 3009 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |