| 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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 | 1347 |
| 1348 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { | 1348 void Builtins::Generate_NotifySoftDeoptimized(MacroAssembler* masm) { |
| 1349 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); | 1349 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1352 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1353 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1353 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 // static | 1356 // static |
| 1357 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1358 int field_index) { | |
| 1359 // ----------- S t a t e ------------- | |
| 1360 // -- eax : number of arguments | |
| 1361 // -- edi : function | |
| 1362 // -- esi : context | |
| 1363 // -- esp[0] : return address | |
| 1364 // -- esp[4] : receiver | |
| 1365 // ----------------------------------- | |
| 1366 | |
| 1367 // 1. Load receiver into eax and check that it's actually a JSDate object. | |
| 1368 Label receiver_not_date; | |
| 1369 { | |
| 1370 __ mov(eax, Operand(esp, kPointerSize)); | |
| 1371 __ JumpIfSmi(eax, &receiver_not_date); | |
| 1372 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); | |
| 1373 __ j(not_equal, &receiver_not_date); | |
| 1374 } | |
| 1375 | |
| 1376 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1377 if (field_index == JSDate::kDateValue) { | |
| 1378 __ mov(eax, FieldOperand(eax, JSDate::kValueOffset)); | |
| 1379 } else { | |
| 1380 if (field_index < JSDate::kFirstUncachedField) { | |
| 1381 Label stamp_mismatch; | |
| 1382 __ mov(edx, Operand::StaticVariable( | |
| 1383 ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1384 __ cmp(edx, FieldOperand(eax, JSDate::kCacheStampOffset)); | |
| 1385 __ j(not_equal, &stamp_mismatch, Label::kNear); | |
| 1386 __ mov(eax, FieldOperand( | |
| 1387 eax, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1388 __ ret(1 * kPointerSize); | |
| 1389 __ bind(&stamp_mismatch); | |
| 1390 } | |
| 1391 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1392 __ PrepareCallCFunction(2, ebx); | |
| 1393 __ mov(Operand(esp, 0), eax); | |
| 1394 __ mov(Operand(esp, 1 * kPointerSize), | |
| 1395 Immediate(Smi::FromInt(field_index))); | |
| 1396 __ CallCFunction( | |
| 1397 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1398 } | |
| 1399 __ ret(1 * kPointerSize); | |
| 1400 | |
| 1401 // 3. Raise a TypeError if the receiver is not a date. | |
| 1402 __ bind(&receiver_not_date); | |
| 1403 { | |
| 1404 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1405 __ Move(ebx, Immediate(0)); | |
| 1406 __ EnterBuiltinFrame(esi, edi, ebx); | |
| 1407 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1408 | |
| 1409 // It's far from obvious, but this final trailing instruction after the call | |
| 1410 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1411 // why: if call were the final instruction in the code object, then the pc | |
| 1412 // (== return address) would point beyond the code object when the stack is | |
| 1413 // traversed. When we then try to look up the code object through | |
| 1414 // StackFrame::LookupCode, we actually return the next code object that | |
| 1415 // happens to be on the same page in memory. | |
| 1416 // TODO(jgruber): A proper fix for this would be nice. | |
| 1417 __ nop(); | |
| 1418 } | |
| 1419 } | |
| 1420 | |
| 1421 // static | |
| 1422 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1357 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1423 // ----------- S t a t e ------------- | 1358 // ----------- S t a t e ------------- |
| 1424 // -- eax : argc | 1359 // -- eax : argc |
| 1425 // -- esp[0] : return address | 1360 // -- esp[0] : return address |
| 1426 // -- esp[4] : argArray | 1361 // -- esp[4] : argArray |
| 1427 // -- esp[8] : thisArg | 1362 // -- esp[8] : thisArg |
| 1428 // -- esp[12] : receiver | 1363 // -- esp[12] : receiver |
| 1429 // ----------------------------------- | 1364 // ----------------------------------- |
| 1430 | 1365 |
| 1431 // 1. Load receiver into edi, argArray into eax (if present), remove all | 1366 // 1. Load receiver into edi, argArray into eax (if present), remove all |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3178 | 3113 |
| 3179 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3114 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3180 Generate_OnStackReplacementHelper(masm, true); | 3115 Generate_OnStackReplacementHelper(masm, true); |
| 3181 } | 3116 } |
| 3182 | 3117 |
| 3183 #undef __ | 3118 #undef __ |
| 3184 } // namespace internal | 3119 } // namespace internal |
| 3185 } // namespace v8 | 3120 } // namespace v8 |
| 3186 | 3121 |
| 3187 #endif // V8_TARGET_ARCH_X87 | 3122 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |