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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 10442015: Rollback of r11638, r11636 on trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 7 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/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) { 376 void MacroAssembler::CmpInstanceType(Register map, InstanceType type) {
377 cmpb(FieldOperand(map, Map::kInstanceTypeOffset), 377 cmpb(FieldOperand(map, Map::kInstanceTypeOffset),
378 static_cast<int8_t>(type)); 378 static_cast<int8_t>(type));
379 } 379 }
380 380
381 381
382 void MacroAssembler::CheckFastElements(Register map, 382 void MacroAssembler::CheckFastElements(Register map,
383 Label* fail, 383 Label* fail,
384 Label::Distance distance) { 384 Label::Distance distance) {
385 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 385 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
386 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 386 STATIC_ASSERT(FAST_ELEMENTS == 1);
387 STATIC_ASSERT(FAST_ELEMENTS == 2);
388 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
389 cmpb(FieldOperand(map, Map::kBitField2Offset), 387 cmpb(FieldOperand(map, Map::kBitField2Offset),
390 Map::kMaximumBitField2FastHoleyElementValue); 388 Map::kMaximumBitField2FastElementValue);
391 j(above, fail, distance); 389 j(above, fail, distance);
392 } 390 }
393 391
394 392
395 void MacroAssembler::CheckFastObjectElements(Register map, 393 void MacroAssembler::CheckFastObjectElements(Register map,
396 Label* fail, 394 Label* fail,
397 Label::Distance distance) { 395 Label::Distance distance) {
398 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 396 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
399 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); 397 STATIC_ASSERT(FAST_ELEMENTS == 1);
400 STATIC_ASSERT(FAST_ELEMENTS == 2);
401 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3);
402 cmpb(FieldOperand(map, Map::kBitField2Offset), 398 cmpb(FieldOperand(map, Map::kBitField2Offset),
403 Map::kMaximumBitField2FastHoleySmiElementValue); 399 Map::kMaximumBitField2FastSmiOnlyElementValue);
404 j(below_equal, fail, distance); 400 j(below_equal, fail, distance);
405 cmpb(FieldOperand(map, Map::kBitField2Offset), 401 cmpb(FieldOperand(map, Map::kBitField2Offset),
406 Map::kMaximumBitField2FastHoleyElementValue); 402 Map::kMaximumBitField2FastElementValue);
407 j(above, fail, distance); 403 j(above, fail, distance);
408 } 404 }
409 405
410 406
411 void MacroAssembler::CheckFastSmiElements(Register map, 407 void MacroAssembler::CheckFastSmiOnlyElements(Register map,
412 Label* fail, 408 Label* fail,
413 Label::Distance distance) { 409 Label::Distance distance) {
414 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); 410 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0);
415 STATIC_ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1);
416 cmpb(FieldOperand(map, Map::kBitField2Offset), 411 cmpb(FieldOperand(map, Map::kBitField2Offset),
417 Map::kMaximumBitField2FastHoleySmiElementValue); 412 Map::kMaximumBitField2FastSmiOnlyElementValue);
418 j(above, fail, distance); 413 j(above, fail, distance);
419 } 414 }
420 415
421 416
422 void MacroAssembler::StoreNumberToDoubleElements( 417 void MacroAssembler::StoreNumberToDoubleElements(
423 Register maybe_number, 418 Register maybe_number,
424 Register elements, 419 Register elements,
425 Register key, 420 Register key,
426 Register scratch1, 421 Register scratch1,
427 XMMRegister scratch2, 422 XMMRegister scratch2,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 bind(&done); 486 bind(&done);
492 } 487 }
493 488
494 489
495 void MacroAssembler::CompareMap(Register obj, 490 void MacroAssembler::CompareMap(Register obj,
496 Handle<Map> map, 491 Handle<Map> map,
497 Label* early_success, 492 Label* early_success,
498 CompareMapMode mode) { 493 CompareMapMode mode) {
499 cmp(FieldOperand(obj, HeapObject::kMapOffset), map); 494 cmp(FieldOperand(obj, HeapObject::kMapOffset), map);
500 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { 495 if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) {
501 ElementsKind kind = map->elements_kind(); 496 Map* transitioned_fast_element_map(
502 if (IsFastElementsKind(kind)) { 497 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL));
503 bool packed = IsFastPackedElementsKind(kind); 498 ASSERT(transitioned_fast_element_map == NULL ||
504 Map* current_map = *map; 499 map->elements_kind() != FAST_ELEMENTS);
505 while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) { 500 if (transitioned_fast_element_map != NULL) {
506 kind = GetNextMoreGeneralFastElementsKind(kind, packed); 501 j(equal, early_success, Label::kNear);
507 current_map = current_map->LookupElementsTransitionMap(kind, NULL); 502 cmp(FieldOperand(obj, HeapObject::kMapOffset),
508 if (!current_map) break; 503 Handle<Map>(transitioned_fast_element_map));
509 j(equal, early_success, Label::kNear); 504 }
510 cmp(FieldOperand(obj, HeapObject::kMapOffset), 505
511 Handle<Map>(current_map)); 506 Map* transitioned_double_map(
512 } 507 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL));
508 ASSERT(transitioned_double_map == NULL ||
509 map->elements_kind() == FAST_SMI_ONLY_ELEMENTS);
510 if (transitioned_double_map != NULL) {
511 j(equal, early_success, Label::kNear);
512 cmp(FieldOperand(obj, HeapObject::kMapOffset),
513 Handle<Map>(transitioned_double_map));
513 } 514 }
514 } 515 }
515 } 516 }
516 517
517 518
518 void MacroAssembler::CheckMap(Register obj, 519 void MacroAssembler::CheckMap(Register obj,
519 Handle<Map> map, 520 Handle<Map> map,
520 Label* fail, 521 Label* fail,
521 SmiCheckType smi_check_type, 522 SmiCheckType smi_check_type,
522 CompareMapMode mode) { 523 CompareMapMode mode) {
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 ElementsKind expected_kind, 2154 ElementsKind expected_kind,
2154 ElementsKind transitioned_kind, 2155 ElementsKind transitioned_kind,
2155 Register map_in_out, 2156 Register map_in_out,
2156 Register scratch, 2157 Register scratch,
2157 Label* no_map_match) { 2158 Label* no_map_match) {
2158 // Load the global or builtins object from the current context. 2159 // Load the global or builtins object from the current context.
2159 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 2160 mov(scratch, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
2160 mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset)); 2161 mov(scratch, FieldOperand(scratch, GlobalObject::kGlobalContextOffset));
2161 2162
2162 // Check that the function's map is the same as the expected cached map. 2163 // Check that the function's map is the same as the expected cached map.
2163 mov(scratch, Operand(scratch, 2164 int expected_index =
2164 Context::SlotOffset(Context::JS_ARRAY_MAPS_INDEX))); 2165 Context::GetContextMapIndexFromElementsKind(expected_kind);
2165 2166 cmp(map_in_out, Operand(scratch, Context::SlotOffset(expected_index)));
2166 size_t offset = expected_kind * kPointerSize +
2167 FixedArrayBase::kHeaderSize;
2168 cmp(map_in_out, FieldOperand(scratch, offset));
2169 j(not_equal, no_map_match); 2167 j(not_equal, no_map_match);
2170 2168
2171 // Use the transitioned cached map. 2169 // Use the transitioned cached map.
2172 offset = transitioned_kind * kPointerSize + 2170 int trans_index =
2173 FixedArrayBase::kHeaderSize; 2171 Context::GetContextMapIndexFromElementsKind(transitioned_kind);
2174 mov(map_in_out, FieldOperand(scratch, offset)); 2172 mov(map_in_out, Operand(scratch, Context::SlotOffset(trans_index)));
2175 } 2173 }
2176 2174
2177 2175
2178 void MacroAssembler::LoadInitialArrayMap( 2176 void MacroAssembler::LoadInitialArrayMap(
2179 Register function_in, Register scratch, 2177 Register function_in, Register scratch, Register map_out) {
2180 Register map_out, bool can_have_holes) {
2181 ASSERT(!function_in.is(map_out)); 2178 ASSERT(!function_in.is(map_out));
2182 Label done; 2179 Label done;
2183 mov(map_out, FieldOperand(function_in, 2180 mov(map_out, FieldOperand(function_in,
2184 JSFunction::kPrototypeOrInitialMapOffset)); 2181 JSFunction::kPrototypeOrInitialMapOffset));
2185 if (!FLAG_smi_only_arrays) { 2182 if (!FLAG_smi_only_arrays) {
2186 ElementsKind kind = can_have_holes ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; 2183 LoadTransitionedArrayMapConditional(FAST_SMI_ONLY_ELEMENTS,
2187 LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, 2184 FAST_ELEMENTS,
2188 kind,
2189 map_out, 2185 map_out,
2190 scratch, 2186 scratch,
2191 &done); 2187 &done);
2192 } else if (can_have_holes) {
2193 LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS,
2194 FAST_HOLEY_SMI_ELEMENTS,
2195 map_out,
2196 scratch,
2197 &done);
2198 } 2188 }
2199 bind(&done); 2189 bind(&done);
2200 } 2190 }
2201 2191
2202 2192
2203 void MacroAssembler::LoadGlobalFunction(int index, Register function) { 2193 void MacroAssembler::LoadGlobalFunction(int index, Register function) {
2204 // Load the global or builtins object from the current context. 2194 // Load the global or builtins object from the current context.
2205 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 2195 mov(function, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
2206 // Load the global context from the global or builtins object. 2196 // Load the global context from the global or builtins object.
2207 mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); 2197 mov(function, FieldOperand(function, GlobalObject::kGlobalContextOffset));
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 // Load the prototype from the map and loop if non-null. 2812 // Load the prototype from the map and loop if non-null.
2823 bind(&check_prototype); 2813 bind(&check_prototype);
2824 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 2814 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
2825 cmp(ecx, isolate()->factory()->null_value()); 2815 cmp(ecx, isolate()->factory()->null_value());
2826 j(not_equal, &next); 2816 j(not_equal, &next);
2827 } 2817 }
2828 2818
2829 } } // namespace v8::internal 2819 } } // namespace v8::internal
2830 2820
2831 #endif // V8_TARGET_ARCH_IA32 2821 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698