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

Side by Side Diff: src/ic.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/ic.h ('k') | src/mips/ic-mips.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 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 PatchInlinedStore(address, Heap::fixed_array_map()); 347 PatchInlinedStore(address, Heap::fixed_array_map());
348 } 348 }
349 349
350 350
351 void KeyedStoreIC::Clear(Address address, Code* target) { 351 void KeyedStoreIC::Clear(Address address, Code* target) {
352 if (target->ic_state() == UNINITIALIZED) return; 352 if (target->ic_state() == UNINITIALIZED) return;
353 SetTargetAtAddress(address, initialize_stub()); 353 SetTargetAtAddress(address, initialize_stub());
354 } 354 }
355 355
356 356
357 Code* KeyedLoadIC::external_array_stub(JSObject::ElementsKind elements_kind) {
358 switch (elements_kind) {
359 case JSObject::EXTERNAL_BYTE_ELEMENTS:
360 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalByteArray);
361 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
362 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalUnsignedByteArray);
363 case JSObject::EXTERNAL_SHORT_ELEMENTS:
364 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalShortArray);
365 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
366 return Builtins::builtin(
367 Builtins::KeyedLoadIC_ExternalUnsignedShortArray);
368 case JSObject::EXTERNAL_INT_ELEMENTS:
369 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalIntArray);
370 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
371 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalUnsignedIntArray);
372 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
373 return Builtins::builtin(Builtins::KeyedLoadIC_ExternalFloatArray);
374 default:
375 UNREACHABLE();
376 return NULL;
377 }
378 }
379
380
381 Code* KeyedStoreIC::external_array_stub(JSObject::ElementsKind elements_kind) {
382 switch (elements_kind) {
383 case JSObject::EXTERNAL_BYTE_ELEMENTS:
384 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalByteArray);
385 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
386 return Builtins::builtin(
387 Builtins::KeyedStoreIC_ExternalUnsignedByteArray);
388 case JSObject::EXTERNAL_SHORT_ELEMENTS:
389 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalShortArray);
390 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
391 return Builtins::builtin(
392 Builtins::KeyedStoreIC_ExternalUnsignedShortArray);
393 case JSObject::EXTERNAL_INT_ELEMENTS:
394 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalIntArray);
395 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS:
396 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalUnsignedIntArray);
397 case JSObject::EXTERNAL_FLOAT_ELEMENTS:
398 return Builtins::builtin(Builtins::KeyedStoreIC_ExternalFloatArray);
399 default:
400 UNREACHABLE();
401 return NULL;
402 }
403 }
404
405
406 static bool HasInterceptorGetter(JSObject* object) { 357 static bool HasInterceptorGetter(JSObject* object) {
407 return !object->GetNamedInterceptor()->getter()->IsUndefined(); 358 return !object->GetNamedInterceptor()->getter()->IsUndefined();
408 } 359 }
409 360
410 361
411 static void LookupForRead(Object* object, 362 static void LookupForRead(Object* object,
412 String* name, 363 String* name,
413 LookupResult* lookup) { 364 LookupResult* lookup) {
414 AssertNoAllocation no_gc; // pointers must stay valid 365 AssertNoAllocation no_gc; // pointers must stay valid
415 366
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 // the global object). 1080 // the global object).
1130 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); 1081 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
1131 1082
1132 if (use_ic) { 1083 if (use_ic) {
1133 Code* stub = generic_stub(); 1084 Code* stub = generic_stub();
1134 if (object->IsString() && key->IsNumber()) { 1085 if (object->IsString() && key->IsNumber()) {
1135 stub = string_stub(); 1086 stub = string_stub();
1136 } else if (object->IsJSObject()) { 1087 } else if (object->IsJSObject()) {
1137 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1088 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1138 if (receiver->HasExternalArrayElements()) { 1089 if (receiver->HasExternalArrayElements()) {
1139 stub = external_array_stub(receiver->GetElementsKind()); 1090 MaybeObject* probe =
1091 StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, false);
1092 stub =
1093 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked());
1140 } else if (receiver->HasIndexedInterceptor()) { 1094 } else if (receiver->HasIndexedInterceptor()) {
1141 stub = indexed_interceptor_stub(); 1095 stub = indexed_interceptor_stub();
1142 } else if (state == UNINITIALIZED && 1096 } else if (state == UNINITIALIZED &&
1143 key->IsSmi() && 1097 key->IsSmi() &&
1144 receiver->map()->has_fast_elements()) { 1098 receiver->map()->has_fast_elements()) {
1145 MaybeObject* probe = StubCache::ComputeKeyedLoadSpecialized(*receiver); 1099 MaybeObject* probe = StubCache::ComputeKeyedLoadSpecialized(*receiver);
1146 stub = 1100 stub =
1147 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); 1101 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked());
1148 } 1102 }
1149 } 1103 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 // Do not use ICs for objects that require access checks (including 1476 // Do not use ICs for objects that require access checks (including
1523 // the global object). 1477 // the global object).
1524 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); 1478 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
1525 ASSERT(!(use_ic && object->IsJSGlobalProxy())); 1479 ASSERT(!(use_ic && object->IsJSGlobalProxy()));
1526 1480
1527 if (use_ic) { 1481 if (use_ic) {
1528 Code* stub = generic_stub(); 1482 Code* stub = generic_stub();
1529 if (object->IsJSObject()) { 1483 if (object->IsJSObject()) {
1530 Handle<JSObject> receiver = Handle<JSObject>::cast(object); 1484 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
1531 if (receiver->HasExternalArrayElements()) { 1485 if (receiver->HasExternalArrayElements()) {
1532 stub = external_array_stub(receiver->GetElementsKind()); 1486 MaybeObject* probe =
1487 StubCache::ComputeKeyedLoadOrStoreExternalArray(*receiver, true);
1488 stub =
1489 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked());
1533 } else if (state == UNINITIALIZED && 1490 } else if (state == UNINITIALIZED &&
1534 key->IsSmi() && 1491 key->IsSmi() &&
1535 receiver->map()->has_fast_elements()) { 1492 receiver->map()->has_fast_elements()) {
1536 MaybeObject* probe = StubCache::ComputeKeyedStoreSpecialized(*receiver); 1493 MaybeObject* probe = StubCache::ComputeKeyedStoreSpecialized(*receiver);
1537 stub = 1494 stub =
1538 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked()); 1495 probe->IsFailure() ? NULL : Code::cast(probe->ToObjectUnchecked());
1539 } 1496 }
1540 } 1497 }
1541 if (stub != NULL) set_target(stub); 1498 if (stub != NULL) set_target(stub);
1542 } 1499 }
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 #undef ADDR 2121 #undef ADDR
2165 }; 2122 };
2166 2123
2167 2124
2168 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2125 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2169 return IC_utilities[id]; 2126 return IC_utilities[id];
2170 } 2127 }
2171 2128
2172 2129
2173 } } // namespace v8::internal 2130 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698