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

Side by Side Diff: src/objects.cc

Issue 99355: Introduce processor detection in globals.h, instead of from the build system. (Closed)
Patch Set: Guard 64-bit literals around 64-bit. Switch to long. Created 11 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
« no previous file with comments | « src/macro-assembler.h ('k') | src/utils.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 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after
4082 4082
4083 // Compares the contents of two strings by reading and comparing 4083 // Compares the contents of two strings by reading and comparing
4084 // int-sized blocks of characters. 4084 // int-sized blocks of characters.
4085 template <typename Char> 4085 template <typename Char>
4086 static inline bool CompareRawStringContents(Vector<Char> a, Vector<Char> b) { 4086 static inline bool CompareRawStringContents(Vector<Char> a, Vector<Char> b) {
4087 int length = a.length(); 4087 int length = a.length();
4088 ASSERT_EQ(length, b.length()); 4088 ASSERT_EQ(length, b.length());
4089 const Char* pa = a.start(); 4089 const Char* pa = a.start();
4090 const Char* pb = b.start(); 4090 const Char* pb = b.start();
4091 int i = 0; 4091 int i = 0;
4092 #ifndef CAN_READ_UNALIGNED 4092 #ifndef V8_HOST_CAN_READ_UNALIGNED
4093 // If this architecture isn't comfortable reading unaligned ints 4093 // If this architecture isn't comfortable reading unaligned ints
4094 // then we have to check that the strings are aligned before 4094 // then we have to check that the strings are aligned before
4095 // comparing them blockwise. 4095 // comparing them blockwise.
4096 const int kAlignmentMask = sizeof(uint32_t) - 1; // NOLINT 4096 const int kAlignmentMask = sizeof(uint32_t) - 1; // NOLINT
4097 uint32_t pa_addr = reinterpret_cast<uint32_t>(pa); 4097 uint32_t pa_addr = reinterpret_cast<uint32_t>(pa);
4098 uint32_t pb_addr = reinterpret_cast<uint32_t>(pb); 4098 uint32_t pb_addr = reinterpret_cast<uint32_t>(pb);
4099 if (((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) == 0) { 4099 if (((pa_addr & kAlignmentMask) | (pb_addr & kAlignmentMask)) == 0) {
4100 #endif 4100 #endif
4101 const int kStepSize = sizeof(int) / sizeof(Char); // NOLINT 4101 const int kStepSize = sizeof(int) / sizeof(Char); // NOLINT
4102 int endpoint = length - kStepSize; 4102 int endpoint = length - kStepSize;
4103 // Compare blocks until we reach near the end of the string. 4103 // Compare blocks until we reach near the end of the string.
4104 for (; i <= endpoint; i += kStepSize) { 4104 for (; i <= endpoint; i += kStepSize) {
4105 uint32_t wa = *reinterpret_cast<const uint32_t*>(pa + i); 4105 uint32_t wa = *reinterpret_cast<const uint32_t*>(pa + i);
4106 uint32_t wb = *reinterpret_cast<const uint32_t*>(pb + i); 4106 uint32_t wb = *reinterpret_cast<const uint32_t*>(pb + i);
4107 if (wa != wb) { 4107 if (wa != wb) {
4108 return false; 4108 return false;
4109 } 4109 }
4110 } 4110 }
4111 #ifndef CAN_READ_UNALIGNED 4111 #ifndef V8_HOST_CAN_READ_UNALIGNED
4112 } 4112 }
4113 #endif 4113 #endif
4114 // Compare the remaining characters that didn't fit into a block. 4114 // Compare the remaining characters that didn't fit into a block.
4115 for (; i < length; i++) { 4115 for (; i < length; i++) {
4116 if (a[i] != b[i]) { 4116 if (a[i] != b[i]) {
4117 return false; 4117 return false;
4118 } 4118 }
4119 } 4119 }
4120 return true; 4120 return true;
4121 } 4121 }
(...skipping 3378 matching lines...) Expand 10 before | Expand all | Expand 10 after
7500 // No break point. 7500 // No break point.
7501 if (break_point_objects()->IsUndefined()) return 0; 7501 if (break_point_objects()->IsUndefined()) return 0;
7502 // Single beak point. 7502 // Single beak point.
7503 if (!break_point_objects()->IsFixedArray()) return 1; 7503 if (!break_point_objects()->IsFixedArray()) return 1;
7504 // Multiple break points. 7504 // Multiple break points.
7505 return FixedArray::cast(break_point_objects())->length(); 7505 return FixedArray::cast(break_point_objects())->length();
7506 } 7506 }
7507 #endif 7507 #endif
7508 7508
7509 } } // namespace v8::internal 7509 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/macro-assembler.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698