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

Side by Side Diff: src/stub-cache.cc

Issue 6303012: Truncate rather than round to nearest when performing float-to-integer... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 Object* result; 500 Object* result;
501 { MaybeObject* maybe_result = 501 { MaybeObject* maybe_result =
502 receiver->UpdateMapCodeCache(name, Code::cast(code)); 502 receiver->UpdateMapCodeCache(name, Code::cast(code));
503 if (!maybe_result->ToObject(&result)) return maybe_result; 503 if (!maybe_result->ToObject(&result)) return maybe_result;
504 } 504 }
505 } 505 }
506 return code; 506 return code;
507 } 507 }
508 508
509 509
510 namespace {
511
512 ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) {
513 switch (kind) {
514 case JSObject::EXTERNAL_BYTE_ELEMENTS:
515 return kExternalByteArray;
516 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
517 return kExternalUnsignedByteArray;
518 case JSObject::EXTERNAL_SHORT_ELEMENTS:
519 return kExternalShortArray;
520 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
521 return kExternalUnsignedShortArray;
522 case JSObject::EXTERNAL_INT_ELEMENTS:
523 return kExternalIntArray;
524 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
525 return kExternalUnsignedIntArray;
526 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
527 return kExternalFloatArray;
528 default:
529 UNREACHABLE();
530 return static_cast<ExternalArrayType>(0);
531 }
532 }
533
534 } // anonymous namespace
535
536
537 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
538 JSObject* receiver,
539 bool is_store) {
540 Code::Flags flags =
541 Code::ComputeMonomorphicFlags(
542 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC,
543 NORMAL);
544 ExternalArrayType array_type =
545 ElementsKindToExternalArrayType(receiver->GetElementsKind());
546 String* name =
547 is_store ? Heap::KeyedStoreExternalArray_symbol()
548 : Heap::KeyedLoadExternalArray_symbol();
549 // Use the global maps for the particular external array types,
550 // rather than the receiver's map, when looking up the cached code,
551 // so that we actually canonicalize these stubs.
552 Map* map = Heap::MapForExternalArrayType(array_type);
553 Object* code = map->FindInCodeCache(name, flags);
554 if (code->IsUndefined()) {
555 ExternalArrayStubCompiler compiler;
556 { MaybeObject* maybe_code =
557 is_store ? compiler.CompileKeyedStoreStub(array_type, flags) :
558 compiler.CompileKeyedLoadStub(array_type, flags);
559 if (!maybe_code->ToObject(&code)) return maybe_code;
560 }
561 if (is_store) {
562 PROFILE(
563 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
564 } else {
565 PROFILE(
566 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0));
567 }
568 Object* result;
569 { MaybeObject* maybe_result =
570 map->UpdateCodeCache(name, Code::cast(code));
571 if (!maybe_result->ToObject(&result)) return maybe_result;
572 }
573 }
574 return code;
575 }
576
577
510 MaybeObject* StubCache::ComputeStoreNormal() { 578 MaybeObject* StubCache::ComputeStoreNormal() {
511 return Builtins::builtin(Builtins::StoreIC_Normal); 579 return Builtins::builtin(Builtins::StoreIC_Normal);
512 } 580 }
513 581
514 582
515 MaybeObject* StubCache::ComputeStoreGlobal(String* name, 583 MaybeObject* StubCache::ComputeStoreGlobal(String* name,
516 GlobalObject* receiver, 584 GlobalObject* receiver,
517 JSGlobalPropertyCell* cell) { 585 JSGlobalPropertyCell* cell) {
518 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); 586 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL);
519 Object* code = receiver->map()->FindInCodeCache(name, flags); 587 Object* code = receiver->map()->FindInCodeCache(name, flags);
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 if (!signature->receiver()->IsUndefined()) { 1770 if (!signature->receiver()->IsUndefined()) {
1703 expected_receiver_type_ = 1771 expected_receiver_type_ =
1704 FunctionTemplateInfo::cast(signature->receiver()); 1772 FunctionTemplateInfo::cast(signature->receiver());
1705 } 1773 }
1706 } 1774 }
1707 1775
1708 is_simple_api_call_ = true; 1776 is_simple_api_call_ = true;
1709 } 1777 }
1710 1778
1711 1779
1780 MaybeObject* ExternalArrayStubCompiler::GetCode(Code::Flags flags) {
1781 Object* result;
1782 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "ExternalArrayStub");
1783 if (!maybe_result->ToObject(&result)) return maybe_result;
1784 }
1785 Code* code = Code::cast(result);
1786 USE(code);
1787 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
1788 return result;
1789 }
1790
1791
1712 } } // namespace v8::internal 1792 } } // namespace v8::internal
OLDNEW
« src/ia32/stub-cache-ia32.cc ('K') | « src/stub-cache.h ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698