| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 int key, | 258 int key, |
| 259 TRBinaryOpIC::TypeInfo operands_type, | 259 TRBinaryOpIC::TypeInfo operands_type, |
| 260 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED) | 260 TRBinaryOpIC::TypeInfo result_type = TRBinaryOpIC::UNINITIALIZED) |
| 261 : op_(OpBits::decode(key)), | 261 : op_(OpBits::decode(key)), |
| 262 mode_(ModeBits::decode(key)), | 262 mode_(ModeBits::decode(key)), |
| 263 use_sse3_(SSE3Bits::decode(key)), | 263 use_sse3_(SSE3Bits::decode(key)), |
| 264 operands_type_(operands_type), | 264 operands_type_(operands_type), |
| 265 result_type_(result_type), | 265 result_type_(result_type), |
| 266 name_(NULL) { } | 266 name_(NULL) { } |
| 267 | 267 |
| 268 // Generate code to call the stub with the supplied arguments. This will add | |
| 269 // code at the call site to prepare arguments either in registers or on the | |
| 270 // stack together with the actual call. | |
| 271 void GenerateCall(MacroAssembler* masm, Register left, Register right); | |
| 272 void GenerateCall(MacroAssembler* masm, Register left, Smi* right); | |
| 273 void GenerateCall(MacroAssembler* masm, Smi* left, Register right); | |
| 274 | |
| 275 private: | 268 private: |
| 276 enum SmiCodeGenerateHeapNumberResults { | 269 enum SmiCodeGenerateHeapNumberResults { |
| 277 ALLOW_HEAPNUMBER_RESULTS, | 270 ALLOW_HEAPNUMBER_RESULTS, |
| 278 NO_HEAPNUMBER_RESULTS | 271 NO_HEAPNUMBER_RESULTS |
| 279 }; | 272 }; |
| 280 | 273 |
| 281 Token::Value op_; | 274 Token::Value op_; |
| 282 OverwriteMode mode_; | 275 OverwriteMode mode_; |
| 283 bool use_sse3_; | 276 bool use_sse3_; |
| 284 | 277 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 Label* slow, | 316 Label* slow, |
| 324 SmiCodeGenerateHeapNumberResults heapnumber_results); | 317 SmiCodeGenerateHeapNumberResults heapnumber_results); |
| 325 void GenerateLoadArguments(MacroAssembler* masm); | 318 void GenerateLoadArguments(MacroAssembler* masm); |
| 326 void GenerateReturn(MacroAssembler* masm); | 319 void GenerateReturn(MacroAssembler* masm); |
| 327 void GenerateUninitializedStub(MacroAssembler* masm); | 320 void GenerateUninitializedStub(MacroAssembler* masm); |
| 328 void GenerateSmiStub(MacroAssembler* masm); | 321 void GenerateSmiStub(MacroAssembler* masm); |
| 329 void GenerateInt32Stub(MacroAssembler* masm); | 322 void GenerateInt32Stub(MacroAssembler* masm); |
| 330 void GenerateHeapNumberStub(MacroAssembler* masm); | 323 void GenerateHeapNumberStub(MacroAssembler* masm); |
| 331 void GenerateStringStub(MacroAssembler* masm); | 324 void GenerateStringStub(MacroAssembler* masm); |
| 332 void GenerateGenericStub(MacroAssembler* masm); | 325 void GenerateGenericStub(MacroAssembler* masm); |
| 326 void GenerateAddStrings(MacroAssembler* masm); |
| 333 | 327 |
| 334 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure); | 328 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure); |
| 335 void GenerateRegisterArgsPush(MacroAssembler* masm); | 329 void GenerateRegisterArgsPush(MacroAssembler* masm); |
| 336 void GenerateTypeTransition(MacroAssembler* masm); | 330 void GenerateTypeTransition(MacroAssembler* masm); |
| 337 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); | 331 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm); |
| 338 | 332 |
| 339 bool IsOperationCommutative() { | |
| 340 return (op_ == Token::ADD) || (op_ == Token::MUL); | |
| 341 } | |
| 342 | |
| 343 virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; } | 333 virtual int GetCodeKind() { return Code::TYPE_RECORDING_BINARY_OP_IC; } |
| 344 | 334 |
| 345 virtual InlineCacheState GetICState() { | 335 virtual InlineCacheState GetICState() { |
| 346 return TRBinaryOpIC::ToState(operands_type_); | 336 return TRBinaryOpIC::ToState(operands_type_); |
| 347 } | 337 } |
| 348 | 338 |
| 349 virtual void FinishCode(Code* code) { | 339 virtual void FinishCode(Code* code) { |
| 350 code->set_type_recording_binary_op_type(operands_type_); | 340 code->set_type_recording_binary_op_type(operands_type_); |
| 351 code->set_type_recording_binary_op_result_type(result_type_); | 341 code->set_type_recording_binary_op_result_type(result_type_); |
| 352 } | 342 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 const char* GetName() { return "NumberToStringStub"; } | 498 const char* GetName() { return "NumberToStringStub"; } |
| 509 | 499 |
| 510 #ifdef DEBUG | 500 #ifdef DEBUG |
| 511 void Print() { | 501 void Print() { |
| 512 PrintF("NumberToStringStub\n"); | 502 PrintF("NumberToStringStub\n"); |
| 513 } | 503 } |
| 514 #endif | 504 #endif |
| 515 }; | 505 }; |
| 516 | 506 |
| 517 | 507 |
| 508 // Generate code to load an element from a pixel array. The receiver is assumed |
| 509 // to not be a smi and to have elements, the caller must guarantee this |
| 510 // precondition. If key is not a smi, then the generated code branches to |
| 511 // key_not_smi. Callers can specify NULL for key_not_smi to signal that a smi |
| 512 // check has already been performed on key so that the smi check is not |
| 513 // generated. If key is not a valid index within the bounds of the pixel array, |
| 514 // the generated code jumps to out_of_range. receiver, key and elements are |
| 515 // unchanged throughout the generated code sequence. |
| 516 void GenerateFastPixelArrayLoad(MacroAssembler* masm, |
| 517 Register receiver, |
| 518 Register key, |
| 519 Register elements, |
| 520 Register untagged_key, |
| 521 Register result, |
| 522 Label* not_pixel_array, |
| 523 Label* key_not_smi, |
| 524 Label* out_of_range); |
| 525 |
| 526 // Generate code to store an element into a pixel array, clamping values between |
| 527 // [0..255]. The receiver is assumed to not be a smi and to have elements, the |
| 528 // caller must guarantee this precondition. If key is not a smi, then the |
| 529 // generated code branches to key_not_smi. Callers can specify NULL for |
| 530 // key_not_smi to signal that a smi check has already been performed on key so |
| 531 // that the smi check is not generated. If the value is not a smi, the generated |
| 532 // code will branch to value_not_smi. If the receiver doesn't have pixel array |
| 533 // elements, the generated code will branch to not_pixel_array, unless |
| 534 // not_pixel_array is NULL, in which case the caller must ensure that the |
| 535 // receiver has pixel array elements. If key is not a valid index within the |
| 536 // bounds of the pixel array, the generated code jumps to out_of_range. |
| 537 void GenerateFastPixelArrayStore(MacroAssembler* masm, |
| 538 Register receiver, |
| 539 Register key, |
| 540 Register value, |
| 541 Register elements, |
| 542 Register scratch1, |
| 543 bool load_elements_from_receiver, |
| 544 Label* key_not_smi, |
| 545 Label* value_not_smi, |
| 546 Label* not_pixel_array, |
| 547 Label* out_of_range); |
| 548 |
| 518 } } // namespace v8::internal | 549 } } // namespace v8::internal |
| 519 | 550 |
| 520 #endif // V8_IA32_CODE_STUBS_IA32_H_ | 551 #endif // V8_IA32_CODE_STUBS_IA32_H_ |
| OLD | NEW |