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

Side by Side Diff: src/heap-inl.h

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
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/heap.cc ('k') | src/heap-profiler.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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
11 // with the distribution. 11 // with the distribution.
(...skipping 30 matching lines...) Expand all
42 // Assert no overflow into live objects. 42 // Assert no overflow into live objects.
43 ASSERT(reinterpret_cast<Address>(rear_) >= HEAP->new_space()->top()); 43 ASSERT(reinterpret_cast<Address>(rear_) >= HEAP->new_space()->top());
44 } 44 }
45 45
46 46
47 int Heap::MaxObjectSizeInPagedSpace() { 47 int Heap::MaxObjectSizeInPagedSpace() {
48 return Page::kMaxHeapObjectSize; 48 return Page::kMaxHeapObjectSize;
49 } 49 }
50 50
51 51
52 MaybeObject* Heap::AllocateStringFromUtf8(Vector<const char> str,
53 PretenureFlag pretenure) {
54 // Check for ASCII first since this is the common case.
55 for (int i = 0; i < str.length(); ++i) {
56 if (static_cast<uint8_t>(str[i]) > String::kMaxAsciiCharCodeU) {
57 // Non-ASCII and we need to decode.
58 return AllocateStringFromUtf8Slow(str, pretenure);
59 }
60 }
61 // If the string is ASCII, we do not need to convert the characters
62 // since UTF8 is backwards compatible with ASCII.
63 return AllocateStringFromAscii(str, pretenure);
64 }
65
66
52 MaybeObject* Heap::AllocateSymbol(Vector<const char> str, 67 MaybeObject* Heap::AllocateSymbol(Vector<const char> str,
53 int chars, 68 int chars,
54 uint32_t hash_field) { 69 uint32_t hash_field) {
55 unibrow::Utf8InputBuffer<> buffer(str.start(), 70 unibrow::Utf8InputBuffer<> buffer(str.start(),
56 static_cast<unsigned>(str.length())); 71 static_cast<unsigned>(str.length()));
57 return AllocateInternalSymbol(&buffer, chars, hash_field); 72 return AllocateInternalSymbol(&buffer, chars, hash_field);
58 } 73 }
59 74
60 75
61 MaybeObject* Heap::CopyFixedArray(FixedArray* src) { 76 MaybeObject* Heap::CopyFixedArray(FixedArray* src) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 565 }
551 return cache->Get(input); 566 return cache->Get(input);
552 } 567 }
553 568
554 569
555 Address TranscendentalCache::cache_array_address() { 570 Address TranscendentalCache::cache_array_address() {
556 return reinterpret_cast<Address>(caches_); 571 return reinterpret_cast<Address>(caches_);
557 } 572 }
558 573
559 574
575 double TranscendentalCache::SubCache::Calculate(double input) {
576 switch (type_) {
577 case ACOS:
578 return acos(input);
579 case ASIN:
580 return asin(input);
581 case ATAN:
582 return atan(input);
583 case COS:
584 return cos(input);
585 case EXP:
586 return exp(input);
587 case LOG:
588 return log(input);
589 case SIN:
590 return sin(input);
591 case TAN:
592 return tan(input);
593 default:
594 return 0.0; // Never happens.
595 }
596 }
597
598
560 MaybeObject* TranscendentalCache::SubCache::Get(double input) { 599 MaybeObject* TranscendentalCache::SubCache::Get(double input) {
561 Converter c; 600 Converter c;
562 c.dbl = input; 601 c.dbl = input;
563 int hash = Hash(c); 602 int hash = Hash(c);
564 Element e = elements_[hash]; 603 Element e = elements_[hash];
565 if (e.in[0] == c.integers[0] && 604 if (e.in[0] == c.integers[0] &&
566 e.in[1] == c.integers[1]) { 605 e.in[1] == c.integers[1]) {
567 ASSERT(e.output != NULL); 606 ASSERT(e.output != NULL);
568 isolate_->counters()->transcendental_cache_hit()->Increment(); 607 isolate_->counters()->transcendental_cache_hit()->Increment();
569 return e.output; 608 return e.output;
(...skipping 22 matching lines...) Expand all
592 #ifdef DEBUG 631 #ifdef DEBUG
593 UpdateLiveObjectCount(obj); 632 UpdateLiveObjectCount(obj);
594 #endif 633 #endif
595 obj->SetMark(); 634 obj->SetMark();
596 } 635 }
597 636
598 637
599 } } // namespace v8::internal 638 } } // namespace v8::internal
600 639
601 #endif // V8_HEAP_INL_H_ 640 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/heap-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698