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

Side by Side Diff: src/arm/code-stubs-arm.h

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 #include "ic-inl.h" 31 #include "ic-inl.h"
32 32
33 namespace v8 { 33 namespace v8 {
34 namespace internal { 34 namespace internal {
35 35
36 36
37 // Compute a transcendental math function natively, or call the 37 // Compute a transcendental math function natively, or call the
38 // TranscendentalCache runtime function. 38 // TranscendentalCache runtime function.
39 class TranscendentalCacheStub: public CodeStub { 39 class TranscendentalCacheStub: public CodeStub {
40 public: 40 public:
41 explicit TranscendentalCacheStub(TranscendentalCache::Type type) 41 enum ArgumentType {
42 : type_(type) {} 42 TAGGED = 0 << TranscendentalCache::kTranscendentalTypeBits,
43 UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits
44 };
45
46 TranscendentalCacheStub(TranscendentalCache::Type type,
47 ArgumentType argument_type)
48 : type_(type), argument_type_(argument_type) { }
43 void Generate(MacroAssembler* masm); 49 void Generate(MacroAssembler* masm);
44 private: 50 private:
45 TranscendentalCache::Type type_; 51 TranscendentalCache::Type type_;
52 ArgumentType argument_type_;
53 void GenerateCallCFunction(MacroAssembler* masm, Register scratch);
54
46 Major MajorKey() { return TranscendentalCache; } 55 Major MajorKey() { return TranscendentalCache; }
47 int MinorKey() { return type_; } 56 int MinorKey() { return type_ | argument_type_; }
48 Runtime::FunctionId RuntimeFunction(); 57 Runtime::FunctionId RuntimeFunction();
49 }; 58 };
50 59
51 60
52 class ToBooleanStub: public CodeStub { 61 class ToBooleanStub: public CodeStub {
53 public: 62 public:
54 explicit ToBooleanStub(Register tos) : tos_(tos) { } 63 explicit ToBooleanStub(Register tos) : tos_(tos) { }
55 64
56 void Generate(MacroAssembler* masm); 65 void Generate(MacroAssembler* masm);
57 66
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 code->set_type_recording_binary_op_result_type(result_type_); 337 code->set_type_recording_binary_op_result_type(result_type_);
329 } 338 }
330 339
331 friend class CodeGenerator; 340 friend class CodeGenerator;
332 }; 341 };
333 342
334 343
335 // Flag that indicates how to generate code for the stub StringAddStub. 344 // Flag that indicates how to generate code for the stub StringAddStub.
336 enum StringAddFlags { 345 enum StringAddFlags {
337 NO_STRING_ADD_FLAGS = 0, 346 NO_STRING_ADD_FLAGS = 0,
338 NO_STRING_CHECK_IN_STUB = 1 << 0 // Omit string check in stub. 347 // Omit left string check in stub (left is definitely a string).
348 NO_STRING_CHECK_LEFT_IN_STUB = 1 << 0,
349 // Omit right string check in stub (right is definitely a string).
350 NO_STRING_CHECK_RIGHT_IN_STUB = 1 << 1,
351 // Omit both string checks in stub.
352 NO_STRING_CHECK_IN_STUB =
353 NO_STRING_CHECK_LEFT_IN_STUB | NO_STRING_CHECK_RIGHT_IN_STUB
339 }; 354 };
340 355
341 356
342 class StringAddStub: public CodeStub { 357 class StringAddStub: public CodeStub {
343 public: 358 public:
344 explicit StringAddStub(StringAddFlags flags) { 359 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {}
345 string_check_ = ((flags & NO_STRING_CHECK_IN_STUB) == 0);
346 }
347 360
348 private: 361 private:
349 Major MajorKey() { return StringAdd; } 362 Major MajorKey() { return StringAdd; }
350 int MinorKey() { return string_check_ ? 0 : 1; } 363 int MinorKey() { return flags_; }
351 364
352 void Generate(MacroAssembler* masm); 365 void Generate(MacroAssembler* masm);
353 366
354 // Should the stub check whether arguments are strings? 367 void GenerateConvertArgument(MacroAssembler* masm,
355 bool string_check_; 368 int stack_offset,
369 Register arg,
370 Register scratch1,
371 Register scratch2,
372 Register scratch3,
373 Register scratch4,
374 Label* slow);
375
376 const StringAddFlags flags_;
356 }; 377 };
357 378
358 379
359 class SubStringStub: public CodeStub { 380 class SubStringStub: public CodeStub {
360 public: 381 public:
361 SubStringStub() {} 382 SubStringStub() {}
362 383
363 private: 384 private:
364 Major MajorKey() { return SubString; } 385 Major MajorKey() { return SubString; }
365 int MinorKey() { return 0; } 386 int MinorKey() { return 0; }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // Currently only needed on ARM. 581 // Currently only needed on ARM.
561 class RegExpCEntryStub: public CodeStub { 582 class RegExpCEntryStub: public CodeStub {
562 public: 583 public:
563 RegExpCEntryStub() {} 584 RegExpCEntryStub() {}
564 virtual ~RegExpCEntryStub() {} 585 virtual ~RegExpCEntryStub() {}
565 void Generate(MacroAssembler* masm); 586 void Generate(MacroAssembler* masm);
566 587
567 private: 588 private:
568 Major MajorKey() { return RegExpCEntry; } 589 Major MajorKey() { return RegExpCEntry; }
569 int MinorKey() { return 0; } 590 int MinorKey() { return 0; }
591
592 bool NeedsImmovableCode() { return true; }
593
570 const char* GetName() { return "RegExpCEntryStub"; } 594 const char* GetName() { return "RegExpCEntryStub"; }
571 }; 595 };
572 596
573 597
574 // Trampoline stub to call into native code. To call safely into native code 598 // Trampoline stub to call into native code. To call safely into native code
575 // in the presence of compacting GC (which can move code objects) we need to 599 // in the presence of compacting GC (which can move code objects) we need to
576 // keep the code which called into native pinned in the memory. Currently the 600 // keep the code which called into native pinned in the memory. Currently the
577 // simplest approach is to generate such stub early enough so it can never be 601 // simplest approach is to generate such stub early enough so it can never be
578 // moved by GC 602 // moved by GC
579 class DirectCEntryStub: public CodeStub { 603 class DirectCEntryStub: public CodeStub {
580 public: 604 public:
581 DirectCEntryStub() {} 605 DirectCEntryStub() {}
582 void Generate(MacroAssembler* masm); 606 void Generate(MacroAssembler* masm);
583 void GenerateCall(MacroAssembler* masm, ApiFunction *function); 607 void GenerateCall(MacroAssembler* masm, ExternalReference function);
584 void GenerateCall(MacroAssembler* masm, Register target); 608 void GenerateCall(MacroAssembler* masm, Register target);
585 609
586 private: 610 private:
587 Major MajorKey() { return DirectCEntry; } 611 Major MajorKey() { return DirectCEntry; }
588 int MinorKey() { return 0; } 612 int MinorKey() { return 0; }
613
614 bool NeedsImmovableCode() { return true; }
615
589 const char* GetName() { return "DirectCEntryStub"; } 616 const char* GetName() { return "DirectCEntryStub"; }
590 }; 617 };
591 618
592 619
593 // Generate code to load an element from a pixel array. The receiver is assumed
594 // to not be a smi and to have elements, the caller must guarantee this
595 // precondition. If key is not a smi, then the generated code branches to
596 // key_not_smi. Callers can specify NULL for key_not_smi to signal that a smi
597 // check has already been performed on key so that the smi check is not
598 // generated. If key is not a valid index within the bounds of the pixel array,
599 // the generated code jumps to out_of_range. receiver, key and elements are
600 // unchanged throughout the generated code sequence.
601 void GenerateFastPixelArrayLoad(MacroAssembler* masm,
602 Register receiver,
603 Register key,
604 Register elements_map,
605 Register elements,
606 Register scratch1,
607 Register scratch2,
608 Register result,
609 Label* not_pixel_array,
610 Label* key_not_smi,
611 Label* out_of_range);
612
613 // Generate code to store an element into a pixel array, clamping values between
614 // [0..255]. The receiver is assumed to not be a smi and to have elements, the
615 // caller must guarantee this precondition. If key is not a smi, then the
616 // generated code branches to key_not_smi. Callers can specify NULL for
617 // key_not_smi to signal that a smi check has already been performed on key so
618 // that the smi check is not generated. If value is not a smi, the generated
619 // code will branch to value_not_smi. If the receiver doesn't have pixel array
620 // elements, the generated code will branch to not_pixel_array, unless
621 // not_pixel_array is NULL, in which case the caller must ensure that the
622 // receiver has pixel array elements. If key is not a valid index within the
623 // bounds of the pixel array, the generated code jumps to out_of_range. If
624 // load_elements_from_receiver is true, then the elements of receiver is loaded
625 // into elements, otherwise elements is assumed to already be the receiver's
626 // elements. If load_elements_map_from_elements is true, elements_map is loaded
627 // from elements, otherwise it is assumed to already contain the element map.
628 void GenerateFastPixelArrayStore(MacroAssembler* masm,
629 Register receiver,
630 Register key,
631 Register value,
632 Register elements,
633 Register elements_map,
634 Register scratch1,
635 Register scratch2,
636 bool load_elements_from_receiver,
637 bool load_elements_map_from_elements,
638 Label* key_not_smi,
639 Label* value_not_smi,
640 Label* not_pixel_array,
641 Label* out_of_range);
642
643 } } // namespace v8::internal 620 } } // namespace v8::internal
644 621
645 #endif // V8_ARM_CODE_STUBS_ARM_H_ 622 #endif // V8_ARM_CODE_STUBS_ARM_H_
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698