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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 | 1296 |
1297 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 1297 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
1298 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 1298 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
1299 } | 1299 } |
1300 | 1300 |
1301 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1301 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
1302 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1302 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
1303 } | 1303 } |
1304 | 1304 |
1305 // static | 1305 // static |
1306 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
1307 int field_index) { | |
1308 // ----------- S t a t e ------------- | |
1309 // -- eax : number of arguments | |
1310 // -- edi : function | |
1311 // -- esi : context | |
1312 // -- esp[0] : return address | |
1313 // -- esp[4] : receiver | |
1314 // ----------------------------------- | |
1315 | |
1316 // 1. Load receiver into eax and check that it's actually a JSDate object. | |
1317 Label receiver_not_date; | |
1318 { | |
1319 __ mov(eax, Operand(esp, kPointerSize)); | |
1320 __ JumpIfSmi(eax, &receiver_not_date); | |
1321 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); | |
1322 __ j(not_equal, &receiver_not_date); | |
1323 } | |
1324 | |
1325 // 2. Load the specified date field, falling back to the runtime as necessary. | |
1326 if (field_index == JSDate::kDateValue) { | |
1327 __ mov(eax, FieldOperand(eax, JSDate::kValueOffset)); | |
1328 } else { | |
1329 if (field_index < JSDate::kFirstUncachedField) { | |
1330 Label stamp_mismatch; | |
1331 __ mov(edx, Operand::StaticVariable( | |
1332 ExternalReference::date_cache_stamp(masm->isolate()))); | |
1333 __ cmp(edx, FieldOperand(eax, JSDate::kCacheStampOffset)); | |
1334 __ j(not_equal, &stamp_mismatch, Label::kNear); | |
1335 __ mov(eax, FieldOperand( | |
1336 eax, JSDate::kValueOffset + field_index * kPointerSize)); | |
1337 __ ret(1 * kPointerSize); | |
1338 __ bind(&stamp_mismatch); | |
1339 } | |
1340 FrameScope scope(masm, StackFrame::INTERNAL); | |
1341 __ PrepareCallCFunction(2, ebx); | |
1342 __ mov(Operand(esp, 0), eax); | |
1343 __ mov(Operand(esp, 1 * kPointerSize), | |
1344 Immediate(Smi::FromInt(field_index))); | |
1345 __ CallCFunction( | |
1346 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
1347 } | |
1348 __ ret(1 * kPointerSize); | |
1349 | |
1350 // 3. Raise a TypeError if the receiver is not a date. | |
1351 __ bind(&receiver_not_date); | |
1352 { | |
1353 FrameScope scope(masm, StackFrame::MANUAL); | |
1354 __ Move(ebx, Immediate(0)); | |
1355 __ EnterBuiltinFrame(esi, edi, ebx); | |
1356 __ CallRuntime(Runtime::kThrowNotDateError); | |
1357 | |
1358 // It's far from obvious, but this final trailing instruction after the call | |
1359 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
1360 // why: if call were the final instruction in the code object, then the pc | |
1361 // (== return address) would point beyond the code object when the stack is | |
1362 // traversed. When we then try to look up the code object through | |
1363 // StackFrame::LookupCode, we actually return the next code object that | |
1364 // happens to be on the same page in memory. | |
1365 // TODO(jgruber): A proper fix for this would be nice. | |
1366 __ nop(); | |
1367 } | |
1368 } | |
1369 | |
1370 // static | |
1371 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1306 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
1372 // ----------- S t a t e ------------- | 1307 // ----------- S t a t e ------------- |
1373 // -- eax : argc | 1308 // -- eax : argc |
1374 // -- esp[0] : return address | 1309 // -- esp[0] : return address |
1375 // -- esp[4] : argArray | 1310 // -- esp[4] : argArray |
1376 // -- esp[8] : thisArg | 1311 // -- esp[8] : thisArg |
1377 // -- esp[12] : receiver | 1312 // -- esp[12] : receiver |
1378 // ----------------------------------- | 1313 // ----------------------------------- |
1379 | 1314 |
1380 // 1. Load receiver into edi, argArray into eax (if present), remove all | 1315 // 1. Load receiver into edi, argArray into eax (if present), remove all |
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3121 | 3056 |
3122 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3057 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3123 Generate_OnStackReplacementHelper(masm, true); | 3058 Generate_OnStackReplacementHelper(masm, true); |
3124 } | 3059 } |
3125 | 3060 |
3126 #undef __ | 3061 #undef __ |
3127 } // namespace internal | 3062 } // namespace internal |
3128 } // namespace v8 | 3063 } // namespace v8 |
3129 | 3064 |
3130 #endif // V8_TARGET_ARCH_IA32 | 3065 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |