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

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

Issue 6315004: 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
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/assembler-x64.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-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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 Object* result; 485 Object* result;
486 { MaybeObject* maybe_result = 486 { MaybeObject* maybe_result =
487 receiver->UpdateMapCodeCache(name, Code::cast(code)); 487 receiver->UpdateMapCodeCache(name, Code::cast(code));
488 if (!maybe_result->ToObject(&result)) return maybe_result; 488 if (!maybe_result->ToObject(&result)) return maybe_result;
489 } 489 }
490 } 490 }
491 return code; 491 return code;
492 } 492 }
493 493
494 494
495 namespace {
496
497 ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) {
498 switch (kind) {
499 case JSObject::EXTERNAL_BYTE_ELEMENTS:
500 return kExternalByteArray;
501 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
502 return kExternalUnsignedByteArray;
503 case JSObject::EXTERNAL_SHORT_ELEMENTS:
504 return kExternalShortArray;
505 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
506 return kExternalUnsignedShortArray;
507 case JSObject::EXTERNAL_INT_ELEMENTS:
508 return kExternalIntArray;
509 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
510 return kExternalUnsignedIntArray;
511 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
512 return kExternalFloatArray;
513 default:
514 UNREACHABLE();
515 return static_cast<ExternalArrayType>(0);
516 }
517 }
518
519 } // anonymous namespace
520
521
522 MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
523 JSObject* receiver,
524 bool is_store) {
525 Code::Flags flags =
526 Code::ComputeMonomorphicFlags(
527 is_store ? Code::KEYED_STORE_IC : Code::KEYED_LOAD_IC,
528 NORMAL);
529 ExternalArrayType array_type =
530 ElementsKindToExternalArrayType(receiver->GetElementsKind());
531 String* name =
532 is_store ? Heap::KeyedStoreExternalArray_symbol()
533 : Heap::KeyedLoadExternalArray_symbol();
534 // Use the global maps for the particular external array types,
535 // rather than the receiver's map, when looking up the cached code,
536 // so that we actually canonicalize these stubs.
537 Map* map = Heap::MapForExternalArrayType(array_type);
538 Object* code = map->FindInCodeCache(name, flags);
539 if (code->IsUndefined()) {
540 ExternalArrayStubCompiler compiler;
541 { MaybeObject* maybe_code =
542 is_store ? compiler.CompileKeyedStoreStub(array_type, flags) :
543 compiler.CompileKeyedLoadStub(array_type, flags);
544 if (!maybe_code->ToObject(&code)) return maybe_code;
545 }
546 if (is_store) {
547 PROFILE(
548 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, Code::cast(code), 0));
549 } else {
550 PROFILE(
551 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), 0));
552 }
553 Object* result;
554 { MaybeObject* maybe_result =
555 map->UpdateCodeCache(name, Code::cast(code));
556 if (!maybe_result->ToObject(&result)) return maybe_result;
557 }
558 }
559 return code;
560 }
561
562
495 MaybeObject* StubCache::ComputeStoreNormal() { 563 MaybeObject* StubCache::ComputeStoreNormal() {
496 return Builtins::builtin(Builtins::StoreIC_Normal); 564 return Builtins::builtin(Builtins::StoreIC_Normal);
497 } 565 }
498 566
499 567
500 MaybeObject* StubCache::ComputeStoreGlobal(String* name, 568 MaybeObject* StubCache::ComputeStoreGlobal(String* name,
501 GlobalObject* receiver, 569 GlobalObject* receiver,
502 JSGlobalPropertyCell* cell) { 570 JSGlobalPropertyCell* cell) {
503 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); 571 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL);
504 Object* code = receiver->map()->FindInCodeCache(name, flags); 572 Object* code = receiver->map()->FindInCodeCache(name, flags);
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 if (!signature->receiver()->IsUndefined()) { 1691 if (!signature->receiver()->IsUndefined()) {
1624 expected_receiver_type_ = 1692 expected_receiver_type_ =
1625 FunctionTemplateInfo::cast(signature->receiver()); 1693 FunctionTemplateInfo::cast(signature->receiver());
1626 } 1694 }
1627 } 1695 }
1628 1696
1629 is_simple_api_call_ = true; 1697 is_simple_api_call_ = true;
1630 } 1698 }
1631 1699
1632 1700
1701 MaybeObject* ExternalArrayStubCompiler::GetCode(Code::Flags flags) {
1702 Object* result;
1703 { MaybeObject* maybe_result = GetCodeWithFlags(flags, "ExternalArrayStub");
1704 if (!maybe_result->ToObject(&result)) return maybe_result;
1705 }
1706 Code* code = Code::cast(result);
1707 USE(code);
1708 PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, "ExternalArrayStub"));
1709 return result;
1710 }
1711
1712
1633 } } // namespace v8::internal 1713 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « 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