blob: ead7761f6576d0b08e1ef288a01267e78979997a [file] [log] [blame]
ricow@chromium.org65fae842010-08-25 15:26:24 +00001// Copyright 2010 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_IA32_CODE_STUBS_IA32_H_
29#define V8_IA32_CODE_STUBS_IA32_H_
30
ricow@chromium.orgd236f4d2010-09-01 06:52:08 +000031#include "macro-assembler.h"
32#include "code-stubs.h"
ricow@chromium.org65fae842010-08-25 15:26:24 +000033#include "ic-inl.h"
34
35namespace v8 {
36namespace internal {
37
38
39// Compute a transcendental math function natively, or call the
40// TranscendentalCache runtime function.
41class TranscendentalCacheStub: public CodeStub {
42 public:
whesse@chromium.org023421e2010-12-21 12:19:12 +000043 enum ArgumentType {
44 TAGGED = 0,
45 UNTAGGED = 1 << TranscendentalCache::kTranscendentalTypeBits
46 };
47
karlklose@chromium.org8f806e82011-03-07 14:06:08 +000048 TranscendentalCacheStub(TranscendentalCache::Type type,
49 ArgumentType argument_type)
whesse@chromium.org023421e2010-12-21 12:19:12 +000050 : type_(type), argument_type_(argument_type) {}
ricow@chromium.org65fae842010-08-25 15:26:24 +000051 void Generate(MacroAssembler* masm);
52 private:
53 TranscendentalCache::Type type_;
whesse@chromium.org023421e2010-12-21 12:19:12 +000054 ArgumentType argument_type_;
ager@chromium.org5f0c45f2010-12-17 08:51:21 +000055
ricow@chromium.org65fae842010-08-25 15:26:24 +000056 Major MajorKey() { return TranscendentalCache; }
whesse@chromium.org023421e2010-12-21 12:19:12 +000057 int MinorKey() { return type_ | argument_type_; }
ager@chromium.org5f0c45f2010-12-17 08:51:21 +000058 Runtime::FunctionId RuntimeFunction();
59 void GenerateOperation(MacroAssembler* masm);
60};
61
62
ricow@chromium.org65fae842010-08-25 15:26:24 +000063class ToBooleanStub: public CodeStub {
64 public:
65 ToBooleanStub() { }
66
67 void Generate(MacroAssembler* masm);
68
69 private:
70 Major MajorKey() { return ToBoolean; }
71 int MinorKey() { return 0; }
72};
73
74
danno@chromium.org40cb8782011-05-25 07:58:50 +000075class UnaryOpStub: public CodeStub {
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +000076 public:
danno@chromium.org40cb8782011-05-25 07:58:50 +000077 UnaryOpStub(Token::Value op, UnaryOverwriteMode mode)
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +000078 : op_(op),
79 mode_(mode),
danno@chromium.org40cb8782011-05-25 07:58:50 +000080 operand_type_(UnaryOpIC::UNINITIALIZED),
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +000081 name_(NULL) {
82 }
83
danno@chromium.org40cb8782011-05-25 07:58:50 +000084 UnaryOpStub(int key, UnaryOpIC::TypeInfo operand_type)
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +000085 : op_(OpBits::decode(key)),
86 mode_(ModeBits::decode(key)),
87 operand_type_(operand_type),
88 name_(NULL) {
89 }
90
91 private:
92 Token::Value op_;
93 UnaryOverwriteMode mode_;
94
95 // Operand type information determined at runtime.
danno@chromium.org40cb8782011-05-25 07:58:50 +000096 UnaryOpIC::TypeInfo operand_type_;
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +000097
98 char* name_;
99
100 const char* GetName();
101
102#ifdef DEBUG
103 void Print() {
104 PrintF("TypeRecordingUnaryOpStub %d (op %s), "
105 "(mode %d, runtime_type_info %s)\n",
106 MinorKey(),
107 Token::String(op_),
108 static_cast<int>(mode_),
danno@chromium.org40cb8782011-05-25 07:58:50 +0000109 UnaryOpIC::GetName(operand_type_));
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000110 }
111#endif
112
113 class ModeBits: public BitField<UnaryOverwriteMode, 0, 1> {};
114 class OpBits: public BitField<Token::Value, 1, 7> {};
danno@chromium.org40cb8782011-05-25 07:58:50 +0000115 class OperandTypeInfoBits: public BitField<UnaryOpIC::TypeInfo, 8, 3> {};
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000116
danno@chromium.org40cb8782011-05-25 07:58:50 +0000117 Major MajorKey() { return UnaryOp; }
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000118 int MinorKey() {
119 return ModeBits::encode(mode_)
120 | OpBits::encode(op_)
121 | OperandTypeInfoBits::encode(operand_type_);
122 }
123
124 // Note: A lot of the helper functions below will vanish when we use virtual
125 // function instead of switch more often.
126 void Generate(MacroAssembler* masm);
127
128 void GenerateTypeTransition(MacroAssembler* masm);
129
130 void GenerateSmiStub(MacroAssembler* masm);
131 void GenerateSmiStubSub(MacroAssembler* masm);
132 void GenerateSmiStubBitNot(MacroAssembler* masm);
karlklose@chromium.org83a47282011-05-11 11:54:09 +0000133 void GenerateSmiCodeSub(MacroAssembler* masm,
134 Label* non_smi,
135 Label* undo,
136 Label* slow,
137 Label::Distance non_smi_near = Label::kFar,
138 Label::Distance undo_near = Label::kFar,
139 Label::Distance slow_near = Label::kFar);
140 void GenerateSmiCodeBitNot(MacroAssembler* masm,
141 Label* non_smi,
142 Label::Distance non_smi_near = Label::kFar);
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000143 void GenerateSmiCodeUndo(MacroAssembler* masm);
144
145 void GenerateHeapNumberStub(MacroAssembler* masm);
146 void GenerateHeapNumberStubSub(MacroAssembler* masm);
147 void GenerateHeapNumberStubBitNot(MacroAssembler* masm);
148 void GenerateHeapNumberCodeSub(MacroAssembler* masm, Label* slow);
149 void GenerateHeapNumberCodeBitNot(MacroAssembler* masm, Label* slow);
150
151 void GenerateGenericStub(MacroAssembler* masm);
152 void GenerateGenericStubSub(MacroAssembler* masm);
153 void GenerateGenericStubBitNot(MacroAssembler* masm);
154 void GenerateGenericCodeFallback(MacroAssembler* masm);
155
danno@chromium.org40cb8782011-05-25 07:58:50 +0000156 virtual int GetCodeKind() { return Code::UNARY_OP_IC; }
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000157
158 virtual InlineCacheState GetICState() {
danno@chromium.org40cb8782011-05-25 07:58:50 +0000159 return UnaryOpIC::ToState(operand_type_);
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000160 }
161
162 virtual void FinishCode(Code* code) {
danno@chromium.org40cb8782011-05-25 07:58:50 +0000163 code->set_unary_op_type(operand_type_);
sgjesse@chromium.org8e8294a2011-05-02 14:30:53 +0000164 }
165};
166
167
danno@chromium.org40cb8782011-05-25 07:58:50 +0000168class BinaryOpStub: public CodeStub {
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000169 public:
danno@chromium.org40cb8782011-05-25 07:58:50 +0000170 BinaryOpStub(Token::Value op, OverwriteMode mode)
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000171 : op_(op),
172 mode_(mode),
danno@chromium.org40cb8782011-05-25 07:58:50 +0000173 operands_type_(BinaryOpIC::UNINITIALIZED),
174 result_type_(BinaryOpIC::UNINITIALIZED),
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000175 name_(NULL) {
kmillikin@chromium.orgc36ce6e2011-04-04 08:25:31 +0000176 use_sse3_ = CpuFeatures::IsSupported(SSE3);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000177 ASSERT(OpBits::is_valid(Token::NUM_TOKENS));
178 }
179
danno@chromium.org40cb8782011-05-25 07:58:50 +0000180 BinaryOpStub(
ager@chromium.org5f0c45f2010-12-17 08:51:21 +0000181 int key,
danno@chromium.org40cb8782011-05-25 07:58:50 +0000182 BinaryOpIC::TypeInfo operands_type,
183 BinaryOpIC::TypeInfo result_type = BinaryOpIC::UNINITIALIZED)
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000184 : op_(OpBits::decode(key)),
185 mode_(ModeBits::decode(key)),
186 use_sse3_(SSE3Bits::decode(key)),
187 operands_type_(operands_type),
188 result_type_(result_type),
ager@chromium.org5f0c45f2010-12-17 08:51:21 +0000189 name_(NULL) { }
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000190
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000191 private:
192 enum SmiCodeGenerateHeapNumberResults {
193 ALLOW_HEAPNUMBER_RESULTS,
194 NO_HEAPNUMBER_RESULTS
195 };
196
197 Token::Value op_;
198 OverwriteMode mode_;
199 bool use_sse3_;
200
201 // Operand type information determined at runtime.
danno@chromium.org40cb8782011-05-25 07:58:50 +0000202 BinaryOpIC::TypeInfo operands_type_;
203 BinaryOpIC::TypeInfo result_type_;
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000204
205 char* name_;
206
207 const char* GetName();
208
209#ifdef DEBUG
210 void Print() {
danno@chromium.org40cb8782011-05-25 07:58:50 +0000211 PrintF("BinaryOpStub %d (op %s), "
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000212 "(mode %d, runtime_type_info %s)\n",
213 MinorKey(),
214 Token::String(op_),
215 static_cast<int>(mode_),
danno@chromium.org40cb8782011-05-25 07:58:50 +0000216 BinaryOpIC::GetName(operands_type_));
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000217 }
218#endif
219
220 // Minor key encoding in 16 bits RRRTTTSOOOOOOOMM.
221 class ModeBits: public BitField<OverwriteMode, 0, 2> {};
222 class OpBits: public BitField<Token::Value, 2, 7> {};
223 class SSE3Bits: public BitField<bool, 9, 1> {};
danno@chromium.org40cb8782011-05-25 07:58:50 +0000224 class OperandTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 10, 3> {};
225 class ResultTypeInfoBits: public BitField<BinaryOpIC::TypeInfo, 13, 3> {};
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000226
danno@chromium.org40cb8782011-05-25 07:58:50 +0000227 Major MajorKey() { return BinaryOp; }
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000228 int MinorKey() {
229 return OpBits::encode(op_)
230 | ModeBits::encode(mode_)
231 | SSE3Bits::encode(use_sse3_)
232 | OperandTypeInfoBits::encode(operands_type_)
233 | ResultTypeInfoBits::encode(result_type_);
234 }
235
236 void Generate(MacroAssembler* masm);
237 void GenerateGeneric(MacroAssembler* masm);
238 void GenerateSmiCode(MacroAssembler* masm,
239 Label* slow,
240 SmiCodeGenerateHeapNumberResults heapnumber_results);
241 void GenerateLoadArguments(MacroAssembler* masm);
242 void GenerateReturn(MacroAssembler* masm);
243 void GenerateUninitializedStub(MacroAssembler* masm);
244 void GenerateSmiStub(MacroAssembler* masm);
245 void GenerateInt32Stub(MacroAssembler* masm);
246 void GenerateHeapNumberStub(MacroAssembler* masm);
lrn@chromium.org7516f052011-03-30 08:52:27 +0000247 void GenerateOddballStub(MacroAssembler* masm);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000248 void GenerateStringStub(MacroAssembler* masm);
danno@chromium.org160a7b02011-04-18 15:51:38 +0000249 void GenerateBothStringStub(MacroAssembler* masm);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000250 void GenerateGenericStub(MacroAssembler* masm);
ager@chromium.org0ee099b2011-01-25 14:06:47 +0000251 void GenerateAddStrings(MacroAssembler* masm);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000252
253 void GenerateHeapResultAllocation(MacroAssembler* masm, Label* alloc_failure);
254 void GenerateRegisterArgsPush(MacroAssembler* masm);
255 void GenerateTypeTransition(MacroAssembler* masm);
256 void GenerateTypeTransitionWithSavedArgs(MacroAssembler* masm);
257
danno@chromium.org40cb8782011-05-25 07:58:50 +0000258 virtual int GetCodeKind() { return Code::BINARY_OP_IC; }
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000259
260 virtual InlineCacheState GetICState() {
danno@chromium.org40cb8782011-05-25 07:58:50 +0000261 return BinaryOpIC::ToState(operands_type_);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000262 }
263
264 virtual void FinishCode(Code* code) {
danno@chromium.org40cb8782011-05-25 07:58:50 +0000265 code->set_binary_op_type(operands_type_);
266 code->set_binary_op_result_type(result_type_);
kasperl@chromium.orga5551262010-12-07 12:49:48 +0000267 }
268
ricow@chromium.orgd236f4d2010-09-01 06:52:08 +0000269 friend class CodeGenerator;
ricow@chromium.org65fae842010-08-25 15:26:24 +0000270};
271
272
273class StringHelper : public AllStatic {
274 public:
275 // Generate code for copying characters using a simple loop. This should only
276 // be used in places where the number of characters is small and the
277 // additional setup and checking in GenerateCopyCharactersREP adds too much
278 // overhead. Copying of overlapping regions is not supported.
279 static void GenerateCopyCharacters(MacroAssembler* masm,
280 Register dest,
281 Register src,
282 Register count,
283 Register scratch,
284 bool ascii);
285
286 // Generate code for copying characters using the rep movs instruction.
287 // Copies ecx characters from esi to edi. Copying of overlapping regions is
288 // not supported.
289 static void GenerateCopyCharactersREP(MacroAssembler* masm,
290 Register dest, // Must be edi.
291 Register src, // Must be esi.
292 Register count, // Must be ecx.
293 Register scratch, // Neither of above.
294 bool ascii);
295
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000296 // Probe the symbol table for a two character string. If the string
297 // requires non-standard hashing a jump to the label not_probed is
298 // performed and registers c1 and c2 are preserved. In all other
299 // cases they are clobbered. If the string is not found by probing a
300 // jump to the label not_found is performed. This jump does not
301 // guarantee that the string is not in the symbol table. If the
302 // string is found the code falls through with the string in
303 // register eax.
ricow@chromium.org65fae842010-08-25 15:26:24 +0000304 static void GenerateTwoCharacterSymbolTableProbe(MacroAssembler* masm,
305 Register c1,
306 Register c2,
307 Register scratch1,
308 Register scratch2,
309 Register scratch3,
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000310 Label* not_probed,
ricow@chromium.org65fae842010-08-25 15:26:24 +0000311 Label* not_found);
312
313 // Generate string hash.
314 static void GenerateHashInit(MacroAssembler* masm,
315 Register hash,
316 Register character,
317 Register scratch);
318 static void GenerateHashAddCharacter(MacroAssembler* masm,
319 Register hash,
320 Register character,
321 Register scratch);
322 static void GenerateHashGetHash(MacroAssembler* masm,
323 Register hash,
324 Register scratch);
325
326 private:
327 DISALLOW_IMPLICIT_CONSTRUCTORS(StringHelper);
328};
329
330
331// Flag that indicates how to generate code for the stub StringAddStub.
332enum StringAddFlags {
333 NO_STRING_ADD_FLAGS = 0,
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000334 // Omit left string check in stub (left is definitely a string).
335 NO_STRING_CHECK_LEFT_IN_STUB = 1 << 0,
336 // Omit right string check in stub (right is definitely a string).
337 NO_STRING_CHECK_RIGHT_IN_STUB = 1 << 1,
338 // Omit both string checks in stub.
339 NO_STRING_CHECK_IN_STUB =
340 NO_STRING_CHECK_LEFT_IN_STUB | NO_STRING_CHECK_RIGHT_IN_STUB
ricow@chromium.org65fae842010-08-25 15:26:24 +0000341};
342
343
344class StringAddStub: public CodeStub {
345 public:
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000346 explicit StringAddStub(StringAddFlags flags) : flags_(flags) {}
ricow@chromium.org65fae842010-08-25 15:26:24 +0000347
348 private:
349 Major MajorKey() { return StringAdd; }
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000350 int MinorKey() { return flags_; }
ricow@chromium.org65fae842010-08-25 15:26:24 +0000351
352 void Generate(MacroAssembler* masm);
353
kmillikin@chromium.org3cdd9e12010-09-06 11:39:48 +0000354 void GenerateConvertArgument(MacroAssembler* masm,
355 int stack_offset,
356 Register arg,
357 Register scratch1,
358 Register scratch2,
359 Register scratch3,
360 Label* slow);
361
362 const StringAddFlags flags_;
ricow@chromium.org65fae842010-08-25 15:26:24 +0000363};
364
365
366class SubStringStub: public CodeStub {
367 public:
368 SubStringStub() {}
369
370 private:
371 Major MajorKey() { return SubString; }
372 int MinorKey() { return 0; }
373
374 void Generate(MacroAssembler* masm);
375};
376
377
378class StringCompareStub: public CodeStub {
379 public:
lrn@chromium.org1c092762011-05-09 09:42:16 +0000380 StringCompareStub() { }
ricow@chromium.org65fae842010-08-25 15:26:24 +0000381
lrn@chromium.org1c092762011-05-09 09:42:16 +0000382 // Compares two flat ASCII strings and returns result in eax.
ricow@chromium.org65fae842010-08-25 15:26:24 +0000383 static void GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
384 Register left,
385 Register right,
386 Register scratch1,
387 Register scratch2,
388 Register scratch3);
389
lrn@chromium.org1c092762011-05-09 09:42:16 +0000390 // Compares two flat ASCII strings for equality and returns result
391 // in eax.
392 static void GenerateFlatAsciiStringEquals(MacroAssembler* masm,
393 Register left,
394 Register right,
395 Register scratch1,
396 Register scratch2);
ricow@chromium.org65fae842010-08-25 15:26:24 +0000397
lrn@chromium.org1c092762011-05-09 09:42:16 +0000398 private:
399 virtual Major MajorKey() { return StringCompare; }
400 virtual int MinorKey() { return 0; }
401 virtual void Generate(MacroAssembler* masm);
402
karlklose@chromium.org83a47282011-05-11 11:54:09 +0000403 static void GenerateAsciiCharsCompareLoop(
404 MacroAssembler* masm,
405 Register left,
406 Register right,
407 Register length,
408 Register scratch,
409 Label* chars_not_equal,
410 Label::Distance chars_not_equal_near = Label::kFar);
ricow@chromium.org65fae842010-08-25 15:26:24 +0000411};
412
413
414class NumberToStringStub: public CodeStub {
415 public:
416 NumberToStringStub() { }
417
418 // Generate code to do a lookup in the number string cache. If the number in
419 // the register object is found in the cache the generated code falls through
420 // with the result in the result register. The object and the result register
421 // can be the same. If the number is not found in the cache the code jumps to
422 // the label not_found with only the content of register object unchanged.
423 static void GenerateLookupNumberStringCache(MacroAssembler* masm,
424 Register object,
425 Register result,
426 Register scratch1,
427 Register scratch2,
428 bool object_is_smi,
429 Label* not_found);
430
431 private:
432 Major MajorKey() { return NumberToString; }
433 int MinorKey() { return 0; }
434
435 void Generate(MacroAssembler* masm);
436
437 const char* GetName() { return "NumberToStringStub"; }
438
439#ifdef DEBUG
440 void Print() {
441 PrintF("NumberToStringStub\n");
442 }
443#endif
444};
445
lrn@chromium.org1c092762011-05-09 09:42:16 +0000446
447class StringDictionaryLookupStub: public CodeStub {
448 public:
449 enum LookupMode { POSITIVE_LOOKUP, NEGATIVE_LOOKUP };
450
451 StringDictionaryLookupStub(Register dictionary,
452 Register result,
453 Register index,
454 LookupMode mode)
455 : dictionary_(dictionary), result_(result), index_(index), mode_(mode) { }
456
457 void Generate(MacroAssembler* masm);
458
karlklose@chromium.org83a47282011-05-11 11:54:09 +0000459 MUST_USE_RESULT static MaybeObject* GenerateNegativeLookup(
460 MacroAssembler* masm,
461 Label* miss,
462 Label* done,
463 Register properties,
464 String* name,
465 Register r0);
lrn@chromium.org1c092762011-05-09 09:42:16 +0000466
467 static void GeneratePositiveLookup(MacroAssembler* masm,
468 Label* miss,
469 Label* done,
470 Register elements,
471 Register name,
472 Register r0,
473 Register r1);
474
475 private:
476 static const int kInlinedProbes = 4;
477 static const int kTotalProbes = 20;
478
479 static const int kCapacityOffset =
480 StringDictionary::kHeaderSize +
481 StringDictionary::kCapacityIndex * kPointerSize;
482
483 static const int kElementsStartOffset =
484 StringDictionary::kHeaderSize +
485 StringDictionary::kElementsStartIndex * kPointerSize;
486
487
488#ifdef DEBUG
489 void Print() {
490 PrintF("StringDictionaryLookupStub\n");
491 }
492#endif
493
494 Major MajorKey() { return StringDictionaryNegativeLookup; }
495
496 int MinorKey() {
497 return DictionaryBits::encode(dictionary_.code()) |
498 ResultBits::encode(result_.code()) |
499 IndexBits::encode(index_.code()) |
500 LookupModeBits::encode(mode_);
501 }
502
503 class DictionaryBits: public BitField<int, 0, 3> {};
504 class ResultBits: public BitField<int, 3, 3> {};
505 class IndexBits: public BitField<int, 6, 3> {};
506 class LookupModeBits: public BitField<LookupMode, 9, 1> {};
507
508 Register dictionary_;
509 Register result_;
510 Register index_;
511 LookupMode mode_;
512};
513
514
ricow@chromium.org65fae842010-08-25 15:26:24 +0000515} } // namespace v8::internal
516
517#endif // V8_IA32_CODE_STUBS_IA32_H_