Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_FAST_ACCESSOR_ASSEMBLER_H_ | 5 #ifndef V8_FAST_ACCESSOR_ASSEMBLER_H_ |
| 6 #define V8_FAST_ACCESSOR_ASSEMBLER_H_ | 6 #define V8_FAST_ACCESSOR_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 typedef v8::experimental::FastAccessorBuilder::LabelId LabelId; | 47 typedef v8::experimental::FastAccessorBuilder::LabelId LabelId; |
| 48 typedef v8::FunctionCallback FunctionCallback; | 48 typedef v8::FunctionCallback FunctionCallback; |
| 49 | 49 |
| 50 explicit FastAccessorAssembler(Isolate* isolate); | 50 explicit FastAccessorAssembler(Isolate* isolate); |
| 51 ~FastAccessorAssembler(); | 51 ~FastAccessorAssembler(); |
| 52 | 52 |
| 53 // Builder / assembler functions: | 53 // Builder / assembler functions: |
| 54 ValueId IntegerConstant(int int_constant); | 54 ValueId IntegerConstant(int int_constant); |
| 55 ValueId GetReceiver(); | 55 ValueId GetReceiver(); |
| 56 ValueId LoadInternalField(ValueId value_id, int field_no); | 56 ValueId LoadInternalField(ValueId value_id, int field_no); |
| 57 | |
| 58 // Unsafe but fast version, does NOT perform any sanity checks. | |
|
vogelheim
2016/07/27 09:50:56
nitpick: Your description is correct, but unnecess
Alfonso
2016/07/28 14:39:13
Acknowledged. I lost objectivity.
| |
| 59 // This is plain unsafe, basically gives read access to memory. | |
| 60 // Use ONLY if can be verified 100% that all access paths have proper | |
| 61 // checks; and the checks are indeed redundant. Security have clear priority | |
| 62 // over performance, there's no trade-off to play here. Use the safe method | |
| 63 // otherwise, it's quite fast. | |
| 64 ValueId LoadInternalFieldUnsafe(ValueId value_id, int field_no); | |
| 65 | |
| 57 ValueId LoadValue(ValueId value_id, int offset); | 66 ValueId LoadValue(ValueId value_id, int offset); |
| 58 ValueId LoadObject(ValueId value_id, int offset); | 67 ValueId LoadObject(ValueId value_id, int offset); |
| 59 | 68 |
| 60 // Builder / assembler functions for control flow. | 69 // Builder / assembler functions for control flow. |
| 61 void ReturnValue(ValueId value_id); | 70 void ReturnValue(ValueId value_id); |
| 62 void CheckFlagSetOrReturnNull(ValueId value_id, int mask); | 71 void CheckFlagSetOrReturnNull(ValueId value_id, int mask); |
| 63 void CheckNotZeroOrReturnNull(ValueId value_id); | 72 void CheckNotZeroOrReturnNull(ValueId value_id); |
| 64 LabelId MakeLabel(); | 73 LabelId MakeLabel(); |
| 65 void SetLabel(LabelId label_id); | 74 void SetLabel(LabelId label_id); |
| 66 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id); | 75 void CheckNotZeroOrJump(ValueId value_id, LabelId label_id); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 95 // strict as this class will be exposed at the API.) | 104 // strict as this class will be exposed at the API.) |
| 96 enum { kBuilding, kBuilt, kError } state_; | 105 enum { kBuilding, kBuilt, kError } state_; |
| 97 | 106 |
| 98 DISALLOW_COPY_AND_ASSIGN(FastAccessorAssembler); | 107 DISALLOW_COPY_AND_ASSIGN(FastAccessorAssembler); |
| 99 }; | 108 }; |
| 100 | 109 |
| 101 } // namespace internal | 110 } // namespace internal |
| 102 } // namespace v8 | 111 } // namespace v8 |
| 103 | 112 |
| 104 #endif // V8_FAST_ACCESSOR_ASSEMBLER_H_ | 113 #endif // V8_FAST_ACCESSOR_ASSEMBLER_H_ |
| OLD | NEW |